how to alert the value of checkbox when it's checked
I want to alert the value of a specific input[checkbox] when an input[checkbox] is checked. I have many input checkbox. so when it's checked, alert will fire.
<input type="checkbox" value="1">
<input type="checkbox" value="2">
<input type="checkbox" value="3">
....
尝试这个:
$('input[type="checkbox"]').change(function() {
if($(this).is(":checked")) {
alert($(this).val())
return;
}
});
链接地址: http://www.djcxy.com/p/56012.html
上一篇: 使用JavaScript将复选框的值加载到字符串中
下一篇: 如何在检查时提醒复选框的值