I want to be able to change an image (actually doing an alert here) when I click on a checkbox with jQuery. Here is my code:
$("input:checkbox[name=who_visible]")[1].click(function() {
alert("test");
});
Here is my input:
<input type="checkbox" name="who_visible" value="1" class="btn_radio_note">
What's wrong?
You are not calling the .click()
function on a jQuery object, this should work,
$("input:checkbox[name=who_visible]").click(function() {
alert("test");
})
$('input:checkbox').live('click',function() {
alert("test");
});
click the link to check fiddle : http://jsfiddle.net/yxKFX/3/
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.