jquery - Wrapping text in HTML if condition is true -


i need wrap text inside <a> between <div> .... </div> tags in html markup:

<li class="first current">   <a href="http://dts.devserver/">home</a> </li> <li class="last has_children sub-menu">   <a href="http://dts.devserver/blog">blog</a> </li> 

but if li has has_children class result should be:

<li class="first current">   <a href="http://dts.devserver/">home</a> </li> <li class="last has_children sub-menu">   <a href="http://dts.devserver/blog"><div>blog</div></a> </li> 

which jquery code or method or property should use? can here?

.wrappinner combined simple selector it.

$('li.has_children a').wrapinner("<div>"); 

Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -