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
原创mb6444ed45406a4 ©著作权
文章标签 javascript ViewUI 文章分类 JavaScript 前端开发
-
jquery option 动态 selected
$("#id").prop('selected',true);
option jquery selected