Remove "ondblclick " event from table row.

Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

bigt95

Thread Starter
Joined
May 30, 2011
Messages
65
I have a page that contains 3 dropdown lists and two tables. Table 1 is populated according to the 3 dropdown lists via ajax and works corectly. The user can then select a row within table 1 by double clicking on a row. Once a row in table 1 has been selected by double clicking on it, that row is then appended to table 2 via "ondblclick" event and the function "GetRow(this)", and this all works fine.

The problem is that once the row is appended to table 2 the function "GetRow(this)" is also appended to each row. If the user "double clicks" a row in table 2 that row is "re"appended to table 2. This is an undisired result, so the "ondblclick" event has to be removed from the appended row. I have tried to remove this event, but have had no luck.

Below is the php code that generates table rows and the jQuery that appends the selected row to table 2.
PHP:
echo "<tr class=\"RowBackGroundColorWhite\" onmouseover=\" SetHighlight(this)\" onmouseout=\"     ResetHighlight(this)\" ondblclick=\"GetRow(this)\">".
 "<td class=\"Pharmacy\">".$SelectPharmacyName[$j]."</td>".
 "</tr>";
jScript

PHP:
function GetRow(row){
 $(row).removeAttr('mouseover');
 $(row).removeAttr('mouseout');
 $(row).css("background-color","transparent");
 $(row).css("font-size","9px");
 $(row).unbind("ondblclick");
 $(row).append("<td><input type=\"button\" value=\"Delete\" onclick=\"RemoveThis(this)\"    style=\"width:50px; height:15px; font-size:7px;\"/></td>");  
 
 $('#LineItem').append(row); 
  $("#TableBody tr").remove();
 }
Please comment
Thanks
 
Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 807,865 other people just like you!

Latest posts

Top