I have a checkbox
<input type="checkbox" name="productIdCheckbox" value="@item.Id">
To check it I run this code:
function checkItem(elem) {
var id = $(elem).attr("id");
$("input[name='productIdCheckbox'][value='" + id + "']").attr("checked", this.checked);
};
What is wrong in my code?
尝试这样的事情
$("input[name='productIdCheckbox'][value='" + id + "']").attr("checked", "checked");
干得好
$("input[value='+id +']").attr("checked", "checked");
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.