javascript - Why jQuery Select box change event is now working? -
i working on product filters user select select box according his/her preference not getting selected value user in jquery.
html code:-
<select name="product_filter" id="product_filter"> <option value="price_low_first">price : low high</option> <option value="price_high_first">price : high low</option> <option value="latest">latest</option> <option value="popular">most popular</option> </select>
jquery code:
$(function () { $("#product_filter").change(function () { alert("hi") var selectedtext = $(this).find("option:selected").text(); var selectedvalue = $(this).val(); alert("selected text: " + selectedtext + " value: " + selectedvalue); }); });
hi believe code perfect. once please check jquery.min.js included in file. please check if there console errors.thank you.
Comments
Post a Comment