$(function(){
$('select[name="question.types"]').change(function(){
//var qtype=$(this).attr("displaytype");
var tdid=$(this).attr("value");
var qtype=$(this).attr("displaytype");
switchType(qtype);
});
});
var qtype=$(this).attr("displaytype");是错误的写法
jquery select change $(this).attr("displaytype")写法错误
以下是正确是写法
$(function(){
$('select[name="question.types"]').change(function(){
//var qtype=$(this).attr("displaytype");
var tdid=$(this).attr("value");
var qtype=$('select[name="question.types"] option[value="'+tdid+'"]').attr("displaytype");
switchType(qtype);
});
});
function initType(){
<c:forEach items="${typeList}" var="type">
$("<option displaytype='${type.displaytype}' value='${type.tdid}'>${type.name}</option>").appendTo($("select[name='question.types']"));
</c:forEach>
}
阿里云国内75折 回扣 微信号:monov8 |
阿里云国际,腾讯云国际,低至75折。AWS 93折 免费开户实名账号 代冲值 优惠多多 微信号:monov8 飞机:@monov6 |