预先准备两张图片表示选中与未选中,当点击该元素时进行选中与未选中图片的切换,即可实现选中与未选中,然后根据该元素的src属性判断是否选中,然后判断该执行什么操作:

    <div class="way-choose ">
        <img  class="choose radio-select" src="select.png"/>
    </div>

 

$(".way-choose").click(function(obj){
    if($(".choose").attr("src")=="select.png"){
        $(".choose").attr("src","not-select.png");
    }else if($(".choose").attr("src")=="not-select.png"){
        $(".choose").attr("src","select.png");
    }
});

 

if($(".choose").attr("src")=="select.png"){
   alert("选中了");

}else if($(".choose").attr("src")=="not-select.png"){
   alert("未选中")  
}

 

相关文章:

  • 2021-12-05
  • 2021-05-23
  • 2022-12-23
  • 2021-09-03
  • 2021-04-01
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-15
相关资源
相似解决方案