var sex = $("#search_form select[name='sex'] option:selected ").attr("value");
var sex = $("#search_form select[name=sex'] option[selected]").attr("value");
这样写会有问题 sex的值有时是undifined
改为
var sex = $("#search_form select[name='sex'] option:selected ").attr("value");
var val = $("#search_form select[name='sex']").children('option:selected').val();
这样就去到了
jquery option selected
最新推荐文章于 2024-04-17 03:13:51 发布