I have 2 tables in a html page. I dynamically, during runtime add additional rows to the first table by clicking an add button.
Then i have a transfer button which when clicked copies all the rows in the first table to the second table.
In the table i have a checkbox in a column. Everything works fine. The data is copied and the checkbox too. But even though i have checked the checkbox in the first table, after the row is copied to the second table, the checkbox in the second table is still
unchecked.
2020.abhilas...
Member
13 Points
24 Posts
Javascript code to modify the page contents
Aug 11, 2012 05:07 PM|LINK
Hi,
I have 2 tables in a html page. I dynamically, during runtime add additional rows to the first table by clicking an add button.
Then i have a transfer button which when clicked copies all the rows in the first table to the second table.
In the table i have a checkbox in a column. Everything works fine. The data is copied and the checkbox too. But even though i have checked the checkbox in the first table, after the row is copied to the second table, the checkbox in the second table is still unchecked.
Can someone please help. Thanks in advance.
shatru
Participant
1513 Points
292 Posts
Re: Javascript code to modify the page contents
Aug 11, 2012 05:26 PM|LINK
Hi,
Please post the code block where you are copying the checkbox to another table.
Regards
Ajatshatru
Dragons Lab
2020.abhilas...
Member
13 Points
24 Posts
Re: Javascript code to modify the page contents
Aug 11, 2012 05:31 PM|LINK
Hi,
Code Snippet:
clone = row1.cloneNode(true);
tbody2 = table2.getElementsByTagName('tr')[0].parentNode;
tbody2.appendChild(clone);
if this helps...
shatru
Participant
1513 Points
292 Posts
Re: Javascript code to modify the page contents
Aug 11, 2012 05:57 PM|LINK
Hi,
Sorry but it is not clear with your code how actually you are copying the checkbox.
Though you can check/uncheck the checkbox through javascript in below manner:
var chkbx = document.getElementById("CheckBox1"); chkbx.checked = true;You can check the status of the original checkbox and check/unceck the clone checkbox accordingly.
Regards
Ajatshatru
Dragons Lab
Angie xu - M...
All-Star
18045 Points
1550 Posts
Microsoft
Re: Javascript code to modify the page contents
Aug 13, 2012 06:25 AM|LINK
Hi
Please refer to the codes in the link below:
http://jsfiddle.net/3BZp4/1/
hope it helpful.
Feedback to us
Develop and promote your apps in Windows Store