Note that there are some explanatory texts on larger screens.

plurals
  1. POClone and delete selected row to another table
    text
    copied!<p>I am tring to clone selected object from one table to another . Till now i am getting the id of selected td to be cloned . Following is the code i am trying.</p> <pre><code>&lt;html xmlns="http://www.w3.org/1999/xhtml"&gt; &lt;head&gt; &lt;script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.0/jquery.min.js"&gt;&lt;/script&gt; &lt;style type="text/css"&gt; .row-highlight { background-color: Yellow; } &lt;/style&gt; &lt;script type="text/javascript"&gt; $(function() { var message = $('#message'); var tr = $('#tbl,#tbl2').find('tr'); tr.bind('click', function(event) { var values = ''; tr.removeClass('row-highlight'); var tds = $(this).addClass('row-highlight').find('td'); $.each(tds, function(index, item) { values = item.id; }); message.html(values); }); }); &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;form&gt; &lt;table&gt; &lt;tr&gt; &lt;td&gt; &lt;table id="tbl" style="border: solid 1px black"&gt; &lt;tr&gt; &lt;td id="a"&gt; 1 &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td id="b"&gt; 2 &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td id="c"&gt; 3 &lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;/td&gt; &lt;td&gt; &lt;table&gt; &lt;tr&gt; &lt;td&gt;&lt;input type="button"name="button one" value="&gt;&gt;" onclick=""&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt; &lt;td&gt;&lt;input type="button" name="button two" value="&lt;&lt;" onclick=""&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;/td&gt; &lt;td&gt; &lt;table id="tbl2" style="border: solid 1px black"&gt; &lt;tr&gt; &lt;td&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;br /&gt; &lt;div id="message"&gt; &lt;/div&gt; &lt;/form&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>How to clone and delete the selected item from table "tbl" to "tbl2" onclick function of button "button one " and vise versa on click of button "button two". Thanks in advance.////</p>
 

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