Reputation: 1672
I've seen this question before but all the answers I saw do not apply to my particular problem. Most of the ones I've seen were caused by the click not being used in a document ready function. All of the stuff in setup_calenders and disable_items is happening but no alert pops up when the checkbox is clicked.
$(document).ready(setup)
function setup() {
$("id_Clearance").click(enable_clearance);
$("id_Paperwork").click(enable_paperwork);
$("id_AVSupport").click(enable_support);
setup_calendars();
disable_items();
}
function enable_paperwork()
{
alert("clicked");
}
Upvotes: 0
Views: 47
Reputation: 9931
I could be wrong as I don't have your html source, but it looks like you might not have the correct selectors for IDs.
Currently, you're doing this:
$("id_Clearance").click(enable_clearance);
$("id_Paperwork").click(enable_paperwork);
$("id_AVSupport").click(enable_support);
If those are indeed supposed to be ids of elements on the page, you'll want to change it to this:
$("#id_Clearance").click(enable_clearance);
$("#id_Paperwork").click(enable_paperwork);
$("#id_AVSupport").click(enable_support);
Notice the # at the start of the selectors. That's what is used to select an id.
Upvotes: 0
Reputation: 70523
Is this what you want?
function setup() {
$("#id_Clearance").click(enable_clearance);
$("#id_Paperwork").click(enable_paperwork);
$("#id_AVSupport").click(enable_support);
setup_calendars();
disable_items();
}
You need to include a # before an element's id to select for id. Just a name like that looks for a tag. eg:
<id_Clearance/>
jQuery has great documentation: http://api.jquery.com/category/selectors/
Upvotes: 1
Reputation: 13334
You're missing the #
signs that indicate that a selector should match an element ID:
$("#id_Clearance").click(enable_clearance);
$("#id_Paperwork").click(enable_paperwork);
$("#id_AVSupport").click(enable_support);
Upvotes: 6