我有一个问题,我想添加“检查”,当我点击输入,但我不知道该怎么办,这里是我的jQuery代码:Jquery - 添加标记“已检查”输入
jQuery('#myId div input').click(function(){
jQuery(this).attr('checked', 'checked');
});
这是我的HTML代码:
<form id="myId">
<div class="grid12-12">
<input type="radio" value="292" id="292" class="required-entry">
<label for="292">Ordonnance.jpg</label>
</div>
</form>
但问题是,如果我这样做,这是什么情况,我有这个在我的标签:
检查=“选中“
我只希望“选中”在我的标签这样
<input type="radio" id="292" value="292" checked>
如果我删除的jQuery的检查是这样的:
jQuery('#myId div input').click(function(){
jQuery(this).attr('', 'checked');
});
我有一个错误。
那么我该怎么做? 在此先感谢:)
这个答案部分是正确的,我会给予好评这个 – Sherlock