how i jquery insert <div> wrapped around non-static array child elements?


i have asp.net formula identical following (this inside fieldset):



<ol>
<li>
<label>some label</label>
<one some-more form controls, asp.net controls, labels, etc.>
</li>
<li>
<label>another label</label>
<... some-more same...>
</li>
...
</ol>


i'm perplexing keep markup purify i presumably can, nonetheless i've solid several reasons, i need hang div around all list vigilant after initial label, this:



<ol>
<li>
<label>some label</label>
<div class="groupthese">
<one some-more form controls, asp.net controls, labels, etc.>
</div>
</li>
<li>
<label>another label</label>
<div class="groupthese">
<... some-more same...>
</div>
</li>
...
</ol>


i rather "unobtrusive javascript" around jquery instead littering page additional markup i keep form semantically "clean".



i know jquery selector initial tag any list vigilant $("li+label") :first-child. i also know insert things after selection.



what i can't figure out (at slightest late during night) all after initial tag list vigilant (or fundamentally all list vigilant solely initial tag another proceed put it) hang div around request prepared function.



update:



owen's formula worked once i private unparalleled quotes around:

$('this')
set repremand decendent selector:
$("li label:first-child")
method wholly name initial tag occurs after list item.



here i did:



$(document).ready(function() {

$('li label:first-child').each(function() {
$(this).siblings().wrapall('<div class="groupthese"></div>');
});
});


Comments

Popular posts from this blog

list macos calm editors formula editors

how i practical urls indicate .aspx pages asp.net deployed an iis? (preferably but iis)

jaxb - xjc - reworking generated typesafe enum category members