JQuery - How to add a single html tag to some html?

Posted by Keith Donegan on Stack Overflow See other posts from Stack Overflow or by Keith Donegan
Published on 2010-05-11T09:54:22Z Indexed on 2010/05/11 10:04 UTC
Read the original article Hit count: 225

Filed under:
|
|
|

Hey Guys,

I want to insert just a single <span> before the text below (right before LINK):

<li><a href="">LINK</a></li>

So, the above becomes

<li><a href=""><span>LINK</a></li>

Here is my JQuery Code:

$('#mainnav li a').prepend('<span>');

When I view the code in firebug after, I see , how do I just get the opening span tag and not the closing tag?

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about span