【发布时间】:2012-10-15 13:03:53
【问题描述】:
我写了这段代码,但它似乎不起作用,见下文:
$('#Reserve, #BuyItNowPrice, #featureplate').attr('disabled','disabled');
$('.fake-fieldset .fake-input').css({'background-color':'#e1e1e1'});
$('.enable').click(function(){
if($('.enable:checked')){
$(this).closest('input').removeAttr('disabled');
}
else{
$(this).closest('input').attr('disabled','disabled');
}
});
这个 HTML 结构在我的代码中重复了 3 次,见下文
<strong><input type="checkbox" class="enable" /> Specify Buy It Now Price</strong>
<div class="fake-fieldset">
<div class="fake-input">
<span>£ </span>
<input type="text" id="BuyItNowPrice" name="BuyItNowPrice" value="" />
</div>
</div>
我希望当我检查.enable 时,最接近的输入应该变为活动状态,以便用户可以键入一个值
任何帮助将不胜感激,谢谢
【问题讨论】:
标签: jquery html-input