Trying to figure out if and how I can get the specific value by only using the class name. Is it even possible?
All selects are generated dynamically and have the same class name. all the submit buttons have the same class name as well.
<div>
<select class="mystat" name="mystat" style="width: 140px">
<option value="1" selected="selected">option 1</option>
<option value="2">option 2</option>
<option value="3">option 3</option>
</select>
<button class="go-btn" type="submit">Update</button>
</div>
$(document).on('click', '.go-btn', function(){
var mystat = $('.mystat').val();
alert('Value is ' + mystat);
});
Any help is greatly appreciated