I'm pretty new to JavaScript and I've been fiddling around with this dropdown menu below.
<form id="bootstrapSelectForm" method="post" class="form-horizontal">
<div class="form-group">
<label class="col-xs-3 control-label">Time period</label>
<div class="col-xs-5 selectContainer">
<select name="time" class="form-control">
<option value="all">All</option>
<option value="1month">1 month</option>
<option value="2months">2 months</option>
<option value="3months">3 months</option>
<option value="6months">6 months</option>
</select>
</div>
<button type="submit" class="btn btn-primary btn-sm">Ok</button>
</div>
</form>
<script type="text/javascript">
function submitClick() {
// Somehow fetch data from dropdown
}
</script>
What I want to do is to retrieve the name/value of the selected item in the dropdown when clicking on the "submit" button and then do something with that value. But I'm a little lost at where to begin with this and any hint or help is greatly appreciated.