I’m working with some server code that is generating html that looks something like:
<input type="radio" />
<label>something</label>
<input type="radio" />
<label>something</label>
<input type="radio" />
<label>something</label>
<input type="radio" />
<label>something</label>
I want to wrap each pair in a span but I can’t figure out a way to select pairs of elements on jquery in order to use wrapAll() on them. I can’t change the html that I am working with. Can anyone help?
nextwill find the closest sibling element.addwill add the matched item to the collection.Demo