[jQuery] How can I add HTML tag from jQuery?
Hi,
Please give me an idea how to do this:
I want to add <a></a> to a table cell.
For example,
If I have the following table;
<table>
<tr><td class="data">Data1</td><td class="value">Value 1</td></tr>
<tr><td class="data">Data2</td><td class="value">Value 2</td></tr>
</table>
Now I want to add anchor to the "data" class, so that result would
look like this:
<table>
<tr><td class="data"><a href="">Data1</a></td><td class="value">Value
1</td></tr>
<tr><td class="data"><a href="">Data2</a></td><td class="value">Value
2</td></tr>
</table>
Now, with jQuery, all I can think of is
$(".data").text().wrap('<a></a>');
but unfortunately, this won't wok.
How can I do this w/jQuery?
thanks for your help in advance.