jQuery Checkbox Error
- by Zack Fernandes
Hello, I am working on a jQuery-based todo list interface, and have hit a bit of a wall. The jQuery I am working with is a bit hacked together from various tutorials I have read, as I'm a bit of a beginner.
$('#todo input:checkbox').click(function(){
var id = this.attr("value");
if(!$(this).is(":checked")) {
alert("Starting.");
$.ajax({
type: "GET",
url: "/todos/check/"+id,
success: function(){
alert("It worked.")
}
});
}
})
This is the HTML I am using,
<div id="todo">
<input type="checkbox" checked="yes" value="1"> Hello, world. <br />
</div>
Any help on this would be greatly appreciated. For reference, thereason I have alerts in the jQuery is for debugging. The reason I can tell the code isn't working is because I am not getting these alerts. Thanks.