on this page, I made a checkbox: http://www.problemio.com
The checkbox looks like this:
<input class="problem_follow_checkbox" TYPE="checkbox" NAME="follow_problem" /> Follow this problem
And in the jQuery I added this:
$("#problem_follow_checkbox").click (function ()
{
alert ("clicked cvheckbox for following problem");
var thisCheck = $(this);
if (thischeck.is (':checked'))
{
// Do stuff
alert ("yes checjed");
}
else
{
alert ("not checjed");
}
});
Seems super straight forward, but for some reason when the checkbox is checked, this jQuery code does not get invoked. Any reason that might be happening?
Thanks!
Use:
$(“#problem_follow_checkbox”) is looking for the ID problem_follow_checkbox so $(“.problem_follow_checkbox”) will be working nice.