I want to use jquery to make sure that my HTML forms have the correct structure and classes.
What I want:
<label class="label-class"><span class="there_is_supposed_to_be_a_span_here">Label</label>
<input class="input-class" type="text" />
So I want to use jquery to add the classes to the elements and also to remove any unwanted spans.
This is what I have so far:
//now remove unwanted spans
var inp = jQuery("input");
var clean = jQuery(inp.outerHTML);
Only problem is that my remove code gets rid of all spans! - I only want to remove spans that are wrapping the inputs or the labels - but I need to leave the span nested inside the label.
How can I do this??