I have a table setup like below:
<table>
<tr>
<td class="url">
<a href="http://www.domainname.com/page1.html" />
</td>
</tr>
<tr>
<td class="url">
<a href="http://www.domainname.com/page2.html" />
</td>
</tr>
<tr>
<td class="url">
<a href="http://www.domainname.com/page3.html" />
</td>
</tr>
</table>
I basically want the anchor to change to a text box containing the href when the link is click, below are example results:
<table>
<tr>
<td class="url">
<input type="text" value="http://www.domainname.com/page1.html" />
</td>
</tr>
<tr>
<td class="url">
<a href="http://www.domainname.com/page2.html" />
</td>
</tr>
<tr>
<td class="url">
<a href="http://www.domainname.com/page3.html" />
</td>
</tr>
</table>
When another anchor tag is click or the text box is unfocused, any text boxes go back to being a anchor and the clicked one changes to a text box.
This is a start. Add a click event to the links and a blur event to the inputs using
live().That being said, for this kind of thing I prefer not to delete elements from the DOM like this. Instead I prefer to just hide/show elements as appropriate. For example:
with:
and