This marks the first time I've ever posed a question on this incredible website. Typically, I can find the answers I need through some research here, but this time that isn't the case, so I'm reaching out for help.
Here's the issue at hand:
I'm in the process of creating a search form that initially consists of a dropdown menu, a text field, and a button. Users select a field (such as field1 or field2) from the dropdown where they want to conduct their search, input the search condition into the text box, and then click an "OR" button. Clicking this "OR" button dynamically generates another set identical to the one before (dropdown, text field, and "OR" button) to add a second search condition.
Below is the crucial portion of the code responsible for inserting the button:
var divid = '#orbuttondiv'+divid;
$(divid).after('<div id="field'+orbuttonid+'" class="blockSrc"><select name="orfield[]" id="condition'+orbuttonid+'field" class="blockSrc'+orbuttonid+'"><option value="0">Select Field</option><?php //function ?></select><input name="orstr[]" id="condition'+orbuttonid+'str" type="text" /></div><div class="orbutton" id="orbuttondiv'+orbuttonid+'"><button name="orbutton'+orbuttonid+'" id="orbutton'+orbuttonid+'" class="btn orbt" type="button" value="OR" /><i class="icon-comments-alt"></i> OR</button></div>');
});
The problem arises when the new set is inserted into the document - everything works perfectly fine except for the prematurely closed button tag. What I anticipate is:
<div class="orbutton" id="orbuttondiv1">
<button class="btn orbt" value="OR" name="orbutton1" id="orbutton1" type="button"><i class="icon-comments-alt"></i> OR</button>
</div>
But what I'm getting instead is:
<div class="orbutton" id="orbuttondiv1">
<button class="btn orbt" value="OR" name="orbutton1" id="orbutton1" type="button"></button><i class="icon-comments-alt"></i> OR
</div>
You'll notice how the opening <button> tag closes before its content, causing the "<i>" and the word "OR" to load outside of the button element.
Any assistance on this matter would be greatly appreciated: