easyui select驗證必填項
阿新 • • 發佈:2019-02-06
<select style="width:140px;" id="terminalType" name="terminalType" class="easyui-validatebox" data-options="validType:'custom_nameForAdd[\'#terminalType\']'" >
<option value="">選擇終端型別</option>
<option value="2">2</option>
<option value="0">0</option>
</select>
$.extend($.fn.validatebox.defaults.rules, {
custom_nameForAdd: {validator: function(value, param) {
console.info($(param[0]).find("option:contains('"+value+"')").val());
return $(param[0]).find("option:contains('"+value+"')").val() != '';
},
message: "該輸入項是必填項!"
}
});