Note that there are some explanatory texts on larger screens.

plurals
  1. POjquery click event fires multiple times :(
    text
    copied!<p>i have the following scenario:</p> <p>i have a table which has trs which all have a "copy" link when the user clicks the "copy" link the parent tr is cloned and appended to the table, now the problem is, first time the click event fires okay, but 2nd time it fires two times, third time it fires three times and so on, and also as i have "cloned" the tr, i want to bind the click function to this cloned tr's "copy" link too, any solutions?</p> <p>i have tried $('.copy-row-link').unbind('click').click(function() { /* the code */ });</p> <p>i have read similiar qns but they doesn't seem to solve my problem</p> <p>my code :</p> <pre><code>$(".copy-row-link").unbind('click').bind('click', function(e) { var strdata = 'class="viewtext" style="background-color:#FFFFFF;" id="highlight1733" onMouseOver="highlight(\'1733\');" onMouseOut="removehighlight(\'1733\');' //var newTr = currTr.clone(true).addClass("viewtext").css( { "backgroundColor" : "#FFFFFF" } ).attr(; var id = currTr.attr("id"); // currTr is set previously var newId = id.replace("highlight", ""); //alert( newId ); newId = parseInt( newId ); newId += 1; var newTr = currTr.clone() .addClass("viewtext newAddedRow") .css("backgroundColor", "#FFFFFF") .attr('id', "highlight" + newId.toString() ) .mouseover( function() { highlight( newId ); } ) .mouseout( function() { removehighlight( newId ); } ); //newTr.appendTo( currTb ); newTr.hide(); newTr.insertAfter( "#" + id ); newTr.fadeIn(100); newTr.attr('id', newId); //e.stopPropagation(); //e.preventDefault(); //e.stopImmediatePropagation(); bindToTr(); // Bind to Tr calls this function again return false; }); </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload