Insert a new html element before another
Hi.
I have a td like this:
- <td id="info">
- <a href="#" id="linkfirst"> <span id="first">First</span> </a>
- <a href="#" id="linkprevious"> <span id="previous">Previous</span> </a>
- <a href="#" id="linknext"> <span id="next">Next</span></a> </a>
- <a href="#" id="linklast"> <span id="last">Last</span></a> </a>
- </td>
I want to remove the two first links and leave only the <span> tags.
I remove the first two elements doing this:
- $('td#info a').first().detach();
- $('td#info a').first().detach();
And I'm trying to put the <span> tag doing this:
- $('#info a').first().prepend('').html('<span id="first">First</span> ');
But this instruction substitutes the code into the "third" element (now first).
How can I put new HTML code before this element?