I don't know if there is any other way, this is not too elegant: $(".data").each(function() { var htmlstr = $(this).html(); $(this).html('<a>' + htmlstr + '</a>'); });
On Jan 4, 12:43 pm, "jQuery(new).to(me)" <[EMAIL PROTECTED]> wrote: > 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.