jquery选取多选框select的值和文本,以及遍历标签
<script type="text/javascript" src="${ctx}/js/jquery-2.0.3.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$('#ew').change(function(){
var curdiv = $('#ew').val();
var divs = $('div');
var divName = $('#ew option:selected').text();
$.each(divs,function(index,item){
if (item.id != curdiv) {
$(item).hide();
} else {
$(item).show();
$('#apiName').text(divName);
}
});
});
});
</script>
其中 ew 是
<select id="ew" name="ew">
<option value="EW010001">上传仓库存货客户</option>
</select>
var curdiv = $('#ew').val();获得EW010001
var divName = $('#ew option:selected').text();获得上传仓库存货客户