1
I have a div
with a pseudo-class :after
where I create a square and place inside a figurine of an arrow down.
I’m trying, with the code below, by clicking on this div
replace the figurine with a similar one:
$(document).ready(function(e) {
contador = 0;
$(".selectOption").click( function() {
if(contador % 2 == 0) {
$(".opcoes").css("overflow", "visible") ;
$(".selectOption:after").css("background-image", "url(_imgs/setaBaixo.jpg)");
} else {
$(".opcoes").css("overflow", "hidden");
$(".selectOption:after").css("background-image", "url(_imgs/setaCima.jpg)");
}
$('.opcoes li').click(function(){ $($(this).closest('ul')).prepend($(this)); })
contador++;
});
$("#select > option").each(function() {
$(".opcoes").append("<li id="+this.value+">"+this.text+"</li>");
});
});
But the figure does not replace.