0条评论
还没有人评论过~
1、HTML代码,如下图:
<p class="sc_member_recharge_form"> <span class="selected">20元</span> <span >50元</span> <span >100元</span> <span >200元</span> <span >300元</span> <span >其它金额</span> </p>
2、jQuery代码,如下图:
<script> $(document).ready(function(){ $(".sc_member_recharge_form span").click(function(){ var select = $(this).text(); if(select === 'other amount' || select === '其它金额'){ $(".sc_member_recharge_form span").removeClass("selected"); $(this).addClass("selected"); }else{ $(".sc_member_recharge_form span").removeClass("selected"); $(this).addClass("selected"); } }); }); </script>