I am creating <td> and adding data to it.
$("<td>").addClass("tableCell1").text(mydata).appendTo(trow);
now if I have to create an <a> tag inside how to do it?
example:
<td headers="xx">
<a href="#" title="zz</a>
</td>
EDIT:
$("<td>").addClass("tableCell1").text(mydata).appendTo(trow);
is working fine but
$('a').attr({ href: '#', title: 'title here' }).appendTo($('td')).appendTo(trow);
is not working, I am not getting the <a> under <td>
I am assuming that you’re trying to create the
<a>and the<td>at the same time. If you’re trying to add the<a>at a different event, you would need a different solution.Note that you didn’t indicate any content for the
<a>in your question. If not styled properly, it will be invisible. If you want to add some text, addtext: "some text"to the<a>creation.