I’m looking to add an attribute (href) into a td of a table.
I guess jQuery would work!
I need help please…
url: http://mysite
The original table:
<table>
<thead>
<tr>
<th>Type</th>
<th>Name</th>
<th>Url</th>
</tr>
</thead>
<tbody>
<tr class='Collection'>
<td>Collection</td>
<td>Collection1</td>
<td>/Collection1</td>
</tr>
<tr class='Site'>
<td>Site</td>
<td>Site1</td>
<td>/site1</td>
</tr>
</tbody>
</table>
So the result would be :
<table>
<thead>
<tr>
<th>Type</th>
<th>Name</th>
<th>Url</th>
</tr>
</thead>
<tbody>
<tr class='Collection'>
<td>Collection</td>
<td>Collection1</td>
<td><a href="http://mysite/Collection1">/Collection1</a></td>
</tr>
<tr class='Site'>
<td>Site</td>
<td>Site1</td>
<td><a href="http://mysite/site1">/site1</a></td>
</tr>
</tbody>
</table>
Assuming you meant “add a link into a
tdof a table”, try this:Demo: http://jsfiddle.net/4hMey/1/