I have a span inside a legend tag that I want to use to remove the fieldset tag when clicked. I'm using jQuery and this is the code that I can't seem to get to work: (yes, i'm using latest version of jQuery)
jQuery:
function removeStep(){
$(this).closest("fieldset").remove();
//Already tried: $(this).parents("fieldset").remove(); . . . didn't work
}
HTML:
<div id="steps">
<fieldset class="step">
<legend>STEP 1: <span class="remove" onclick="removeStep();">remove</span></legend>
</fieldset>
</div>