当前位置 博文首页 > 渊渟无迹静涛君的博客:EasyUi下拉框选值时触发js事件。

    渊渟无迹静涛君的博客:EasyUi下拉框选值时触发js事件。

    作者:[db:作者] 时间:2021-08-16 18:46

    具体实列:

    <td><select name="politicalType" id="politicalType" style="width:150px;" 
    class="easyui-combobox" data-options="editable:false" onchange="change()">
     <option value="1" <c:if test="${custom.politicalType==1}">selected="selected"</c:if>>中共党员</option>
     <option value="2" <c:if test="${custom.politicalType==2}">selected="selected"</c:if>>中共预备党员</option>
     <option value="3" <c:if test="${custom.politicalType==3}">selected="selected"</c:if>>共青团员</option>
     <option value="4" <c:if test="${custom.politicalType==4}">selected="selected"</c:if>>民革党员</option>
     <option value="5" <c:if test="${custom.politicalType==5}">selected="selected"</c:if>>民盟盟员</option>
     <option value="6" <c:if test="${custom.politicalType==6}">selected="selected"</c:if>>民建会员</option>
     <option value="7" <c:if test="${custom.politicalType==7}">selected="selected"</c:if>>民进会员</option>
     <option value="8" <c:if test="${custom.politicalType==8}">selected="selected"</c:if>>农工党党员</option>
     <option value="9" <c:if test="${custom.politicalType==9}">selected="selected"</c:if>>致公党党员</option>
     <option value="10" <c:if test="${custom.politicalType==10}">selected="selected"</c:if>>九三学社社员</option>
     <option value="11" <c:if test="${custom.politicalType==11}">selected="selected"</c:if>>台盟盟员</option>
     <option value="12" <c:if test="${custom.politicalType==12}">selected="selected"</c:if>>无党派人士</option>
     <option value="13" <c:if test="${custom.politicalType==13}">selected="selected"</c:if>>群众</option>							
    </select></td>

    js触发下拉事件:

    $("#politicalType").combobox({
    ?? ??? ? ? ?onSelect: function () {
    ? ? ? ? ? ? var newPtion = $("#politicalType").combobox('getText')
    ? ? ? ? ? ? if (newPtion == "中共党员") {
    ? ? ? ? ? ? ?? ?$('#partyBranchId').combobox('enable'); //允许easyui下拉框使用
    ? ? ? ? ? ? ?? ?$('#subjection').textbox('textbox').attr('readonly',false);?//允许easyui文本框使用
    ? ? ? ? ? ? ?? ?$('#partyDuties').textbox('textbox').attr('readonly',false);
    ? ? ? ? ? ? ?? ?$('#partyFee').textbox('textbox').attr('readonly',false);
    ? ? ? ? ? ? ?? ?$('#joinPartyDate').datebox('enable');
    ? ? ? ? ? ? }
    ? ? ? ? ? ? else {
    ? ? ? ? ? ? ?? ?//党建信息
    ? ? ? ? ? ? ?? ?$('#partyBranchId').combobox('disable'); ? //禁止easyui下拉框使用
    ? ? ? ? ? ? ?? ?$('#subjection').textbox('textbox').attr('readonly',true); //禁止easyui文本框使用
    ? ? ? ? ? ? ?? ?$('#partyDuties').textbox('textbox').attr('readonly',true);
    ? ? ? ? ? ? ?? ?$('#partyFee').textbox('textbox').attr('readonly',true);
    ? ? ? ? ? ? ?? ?$('#joinPartyDate').datebox('disable');
    ? ? ? ? ? ? ?}
    ? ? ? ? ?}
    ?? ??? ?});

    cs