Skip links

JQuery click event not working

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

[stextbox id=”info”]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.[/stextbox]

3-Try to use jquery bind event.

 $('#elementID').bind('click', function() {
  //  see the above bind event usage


  • -the relevant page contents is loaded or not.
  • -clear all cache in the browser.
  • -java script is enabled in the browser.