I'm trying to format and change the structure of a standard HTML form. At the moment the output looks like this
<form accept-charset="UTF-8" autocomplete="off" method="POST">
<ol class="questions">
<div>
<label>First Name *</label>
<input type="text" />
</div>
<div>
<label>Email *</label>
<input type="text" />
</div>
<div class="submit">
<input type="submit" value="Submit" />
</div>
</ol>
</div>
</form>
I need to change the divs to list items and then add a span around the labels if possible.
I've got this so far but it's not altering unfortunately.
window.onload = function() {
var widgetHTML = $('ol.questions').html();
widgetHTML = widgetHTML
.replace(/<div>/g, '<li>')
.replace(/<\/div>/g, '</li>');
$('ol.questions').html(widgetHTML);
};
Any ideas to add the span and replace the DIVs to LIs that would be great