I am using Bootstrap with jquery to create a dynamic table consisting dropdown menu and button. I want to get value of dropdown menu selected in jquery on button click.
Below is my code
<table class="table table-bordered">
<tbody>
{% for item in items %}
<tr>
<td>
<div class="dropdown">
<button class="btn btn-secondary dropdown-toggle" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Select
</button>
<ul class="dropdown-menu" role="menu" id="options" onchange="selectFromDropDown(this.value)">
<li><a id="weekly" selected>Option 1</a></li>
<li><a id="biweekly">Option 2</a></li>
<li><a id="monthly">Option 3</a></li>
</ul>
</div>
</td>
<td>
<form data-toggle="validator" role="form" >
<input type="submit" value="Update" class="btn btn-xs btn-block" id="update">
</form>
</td>
</tr>
{% endfor %}
</tbody>
</table>
And below is the jquery
$('#update').click(function(){
alert($('#options option:selected').html())
});
When I run above code it returns "undefined".