i have two html element and i want to change it with another by clicking on one. this is my code and it works but one time:
<div class="ic_lk"></div>
<?php $pic=0;?>
<script>
$('document').ready(function(){
var pic= <?php echo $pic;?>;
if(pic==0) {
$('.ic_lk').html('<img class="li_ik1" src="_pc/lk.png"></img>');
}else if(pic>0){
$('.ic_lk').html('<img class="li_ik2" src="_pc/lkm.png"></img>');
}
$(".li_ik1").on("click",function(){
$(this).replaceWith('<img class="li_ik2" src="_pc/lkm.png"/>');
});
$(".li_ik2").on("click",function(){
$(this).replaceWith('<img class="li_ik1" src="_pc/lk.png"/>');
});
});
</script>
thanks