I am trying to understand something. I get a string of html code by doing the following
var formDataUnformatted = $("#content").html();
If I output formDataUnformatted I get something like the following
<div class="form-group ui-draggable ui-draggable-handle element" data-type="text"><div class="close">×</div>
<label for="text_input" class="control-label col-sm-4">Text Input</label>
<div class="controls col-sm-7">
<input id="text_input" class="form-control" name="text_input" type="text">
</div>
</div>
Now with the above, I need to remove some classes, and get rid of a div. I essentially need to turn it into the following
<div class="form-group">
<label for="text_input" class="control-label col-sm-4">Text Input</label>
<div class="controls col-sm-7">
<input id="text_input" class="form-control" name="text_input" type="text">
</div>
</div>
To do this, I do the following
var cleanFormData = formDataUnformatted.replace(/\t/, "").replace(/ ui-draggable| element/gi, "").replace(/<div class="close">.<\/div>/g, "").replace(/ data-(.+)="(.+)"/g, "");
Now this pretty much does everything I need it to do, but there is one thing I do not understand. If I output cleanFormData, I get the following
<div class="form-group-handle">
<label for="text_input" class="control-label col-sm-4">Text Input</label>
<div class="controls col-sm-7">
<input id="text_input" class="form-control" name="text_input" type="text">
</div>
</div>
Now this is perfect, apart from where it adds -handle to form-group. I do not want form-group-handle, I just want it to be form-group.
Where is it getting this -handle from?
Thanks