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>"); }); 

http://jsfiddle.net/6ezds/

(or using wrap)

$("li span.mad").each(function(i,e) {  $(e).wrap("<a href='/my/website/"+ (i+1) +"' />"); }); 

Comments

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -