1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

Remove "ondblclick " event from table row.

Discussion in 'Web Design & Development' started by bigt95, Oct 30, 2011.

Thread Status:
Not open for further replies.
  1. bigt95

    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
     
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 733,556 other people just like you!

Loading...
Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/1024725

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice