I have an html form and having a little trouble getting the selected value on it, here is the html
<form>
<div class="row">
<div class="form-group col-xs-12 col-md-8">
<label>Contact Info</label>
<input tabIndex="100" class="form-control square" placeholder="Your email address" autocomplete="off" data-error-style="inline" name="email" type="text">
</div>
<div class="form-group col-xs-12 col-md-4">
<label>Gender</label>
<div class="drop-down-holder ">
<div class="simple-dropdown dropdown btn-dropdown dropdown-module dropdown-toggle"
data-toggle="dropdown"
type="button">
<button tabindex="101" class="dropdown-module dropdown-toggle" type="button" data-toggle="dropdown" data-target="#">
<div class="simple-holder">
<div class="dropdown-label">Select Gender</div>
<div class="icon-holder"><i class="icon-caret-down"></i></div>
</div>
</button>
<ul class="dropdown-menu" role="menu">
<li><a class="female">Female</a></li>
<li><a class="male">Male</a></li>
</ul>
</div>
</div>
</div>
</div>
</form>
I've tried a few things in console and keep getting empty strings This is what I've tried
$(".dropdown-menu").text();
This one returns just the text female and male in a string
$(".dropdown-menu").val();
empty string $(".dropdown-menu :selected").text();
also empty string
$(".dropdown-menu option:selected").text();
empty
$('.dropdown-menu option:selected').val();
undefined
So any clue on how I can get weather the user selected male or female? I need that value for a conditional statement that will redirect them to a certain page depending on their gender.
$('.dropdown-menu').find('li > a').on('click', function() { console.log($(this).text()); });?