Add html Using JQuery -
i have this:
<span class="mad">2</span> stuff </li>
i want this
<a href="/my/website"><span class="mad">2</span> website</a> </li>
can give me jquery this? "/my/website" has changed different each li...is possible?
using each, can give each li span.mad different website url
$("li span.mad").each(function(i,e) { $(e).html( "<a href='/my/website/"+ (i+1) +"'>"+$(e).html()+"</a>"); });
(or using wrap
)
$("li span.mad").each(function(i,e) { $(e).wrap("<a href='/my/website/"+ (i+1) +"' />"); });
Comments
Post a Comment