I have a select options menu. I want that jQuery/ javascript appends an input field in a specific "div content" under the menu when clicking a certain option value in it.
At the moment nothing gets triggered with the click event.
If you click in the select menu on the option value "Search Field" an input field should be created in the <div id="content"> area.
My code:
$('.inputicon').click(function() {
$(".content").append('<input id="test">')
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<select name="category6" id="category6" class="form-control">
<option value="">Delete</option>
<optgroup label="Search" value="iconsearch">
<option class="inputicon " value="16">Search Field</option>
</optgroup>
</select>
<div id="content"></div>
clickevents. Use thechangeevent of the dropdown.