Link to home
Start Free TrialLog in
Avatar of maccaj51
maccaj51Flag for Afghanistan

asked on

Jquery: Append selected data from one table into another

Hi Experts,

I have attached some code below. I am looking to toggle add/remove selected rows from one table to another when the checkbox in a row has been selected.

So when a user checks an input in tableA it adds the row to tableB with only the correct columns added (as you will see there are less columns in tableB)

I also need it to remove these rows from tableB when user unchecks the input in tableA

(Not removing any rows from tableA)

Many thanks for any assistance offered

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head>

<body>

<table width="100%" border="0" cellspacing="0" cellpadding="0" id="tableA">
  <tr>
    <th scope="col">Select</th>
    <th scope="col">Name</th>
    <th scope="col">Birth Year</th>
    <th scope="col">Birth Month</th>
  </tr>
  <tr>
    <td><input type="checkbox" /></td>
    <td>Alex</td>
    <td>1980</td>
    <td>October</td>
  </tr>
  <tr>
    <td><input type="checkbox" /></td>
    <td>Mike</td>
    <td>1976</td>
    <td>December</td>
  </tr>
  <tr>
    <td><input type="checkbox" /></td>
    <td>Robert</td>
    <td>1954</td>
    <td>May</td>
  </tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0" id="tableA">
  <tr>
    <th scope="col">Select</th>
    <th scope="col">Name</th>
  </tr>
  <tr>
    <td><input type="checkbox" /></td>
    <td>%Name%</td>
  </tr>
</table>
</body>
</html>

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Julian Hansen
Julian Hansen
Flag of South Africa image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of maccaj51

ASKER

Brilliant!!! Many many thanks!!!
You are welcome - thanks for the points.