tags:

views:

26

answers:

2
 $("#table_id").click(function(e) {
                  var row = jQuery(e.target || e.srcElement).parent();
                  $("#table_id").bind('click', loaddata);
                  name= row.attr("id");
              });

loaddata is the funcation I am calling on click on each row..

but this cilck event is working for double click.. I mean when you double click its working fyn.. but i need it to work for single click on the row.. is that anything I am doing wrong here?

thanks

+1  A: 

change

$("#table_id").bind('click', loaddata);

to

$("#table_id").bind('click', function() {loaddata();});

Also, it looks a bit weird in the fact inside the $("table_id") click, you are binding a function to the click.

Are you meaning to do the following?

 $(row).bind('click', function() {loaddata();});
GordonB
Thanks for replay how to get the row id?thanks
kumar
+1  A: 

The JQuery click function is the same as the bind function using the 'click' parameter. The reason it works for double-click is that the initial click function fires the bind function which then allows click to fire loaddata.

Instead try passing the row and name to loaddata:

 $("#table_id").click(function(e) {
              var row = jQuery(e.target || e.srcElement).parent();
              name = row.attr("id");
              loaddata(row, name);
          });
elkelk