1

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?

2 Answers 2

1

You are not calling the .click() function on a jQuery object, this should work,

$("input:checkbox[name=who_visible]").click(function() {
   alert("test");
})
Sign up to request clarification or add additional context in comments.

Comments

0
$('input:checkbox').live('click',function() {
   alert("test");
});

click the link to check fiddle : http://jsfiddle.net/yxKFX/3/

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.