jquery - Get combo box selected value -
i have button that, when clicked, should me value of combo box's selected item. example, if have following combo , 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 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 isn't working, returns nothing. help?
use
$("#client-sort-type").val()
Comments
Post a Comment