I loaded the jquery library files properly.But it click event does not trigger the function.No errors display in the firebug console.This is a common issue of most users.Here the solutions for this.
1-First check your click event is placed in the $(document).ready function.If it out side of the $(document).ready function,keep it in there.
$(document).ready(function () { $('#elementID').click(function () { // do somthing }); });
2-Second thing write the JQuery live event like this.
$(document).ready(function () { $('#elementID').live('click',function () { // see the above live event usage }); });
When we use live function, JQuery starts keeping track of all the changes made in the DOM, that includes the new data/elements from the other request(ajax) or removal of any element.
It’s basic JavaScript to wait until the DOM is ready before you try to use an element.
It’s basic JavaScript to wait until the DOM is ready before you try to use an element.
3-Try to use jquery bind event.
$('#elementID').bind('click', function() { // see the above bind event usage });
Extra:
Check,
- -The page content is loaded or not.
- -Clear all cache in the browser.
- -Javascript is enabled in the browser.