Need help to write text in td
Hi,
Need help.
I have table (tableA) with single td. (multiple rows)
td having checkbox (checked or unchecked.)
I create clone of tableA and in that I don't want checkbox. Instead of that I want some text like "checkbox checked" or "checkbox unchecked"
On button click what I done so far is:
- function buttonClick()
{
//Create clone
var t = $('#tableA').clone(true);
//remove all href tag in side td
$('a', t).filter(function () { return $(this)}).removeAttr("href");
//To remove checkbox and add text
//class dummyChk given on <input type='checkbox'>
$('td .dummyChk', t).filter(function() {
if ($(this).attr("checked")) {
alert("checkbox checked");
//Above check box alert work properly
//also can view the html of the td
alert($(this).closest('td').html());
//But not able to write text inside td
$(this).closest('td').html('Checkbox checked');
}
else{
alert("checkbox unchecked");
}
}
}
Kindly guide.
Thanks,