只是需要一些帮助来解决这个小问题,例如,如果我对苹果投票,我想禁用苹果之后的所有链接,这个脚本以某种方式工作,但它不像我想要的那样工作,但我仍在学习 jQuery,所以我没有足够的经验
<script type="text/javascript">
$(document).ready(function() {
$("#container .bar a").click(function() {
var target = $(this);
target.html('Voted').addClass('voted');
//$('span a').removeAttr('href'); // this doese not help
return false;
});
});
</script>
<div id="container">
<span id="question">What is your favorite</span>
<div class="bar"><span> 10% </span><span><a class="a" href="">Vote</a></span> apple</div>
<div class="bar"><span> 20% </span><span><a class="a" href="">Vote</a></span> banana</div>
<div class="bar"><span> 30% </span><span><a class="a" href="">Vote</a></span> lemon</div>
</div><!--end container-->