Good day!
When working with a set there was an incomprehensible problem to me. I am required to wrap the whole set in one item. for example, you need to wrap all input type="radio"
div
element. I am writing the following:
jQuery
code:
$(function(){ var form = $('form').children(); form.each(function(n){ if($(this).is(':radio') $(':radio').wrapAll('<div class="radios"></div'); }); });
And, it seems, there should be happiness - all radio
elements should turn around with a common div
element. Annette! in the DOM
see the following:
DOM
:
<div class="radios"> <div class="radios"> <input type="radio" name="choise" value="yes"/>Yes <input type="radio" name="choise" value="no"/>No </div> </div>
I can't figure out where the external div
comes from. Tell me please!
Amendment!!! You cannot leave the loop bypass!))