I have a button that, when clicked, should get me the value of a combo box's selected item. For example, if I have the following combo and button:
<select id="client-sort-type">
<option></option>
<option>Name</option>
<option>Recent</option>
</select>
<button id="client-sort-submit" type="button">Sort</button>
I want something like...
<script type="text/javascript">
$("#client-sort-submit").click(function () {
var val = $("#client-sort-type").attr("value");
window.location.href = "Project/Index/" + val;
});
</script>
Only this isn't working, it always returns nothing. Help?