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=$(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>}