我的页面上有一个dijit.form.Select:
<c:set var="qualId" value="${prevIoUs.qualification.id}" /> <select id="qualification" name="qualification" dojoType="dijit.form.Select" onchange="checkForPHD()"> <option value="-1" label=" "> </option> <c:forEach items="${requestScope.qualifications}" var="qualItem"> <c:choose> <c:when test="${qualId eq qualItem.id}"> <option value="${qualItem.id}" selected = "selected">${qualItem.name}</option> </c:when> <c:otherwise> <option value="${qualItem.id}">${qualItem.name}</option> </c:otherwise> </c:choose> </c:forEach> </select>
然后我试图用一些javascript来设置一些文本到从选择框中选择的选项的TEXT;
function checkForPHD() { dojo.byId('clazzPHDMessage').innerHTML = dojo.byId('qualification') .attr('displayedValue'); }
我读过.attr(‘displayedValue’)假设从dijit.form.Select中的选定选项中获取文本,但它似乎没有做太多? .attr(‘value’)得到了那些值,但是我需要TEXT?