isEnabled
如果选定的 DOM 元素已启用,则返回 true 或 false。
用法
$(selector).isEnabled()
示例
index.html
<input type="text" name="inputField" class="input1">
<input type="text" name="inputField" class="input2" disabled>
<input type="text" name="inputField" class="input3" disabled="disabled">
isEnabled.js
it('should detect if an element is enabled', async () => {
let elem = await $('.input1')
let isEnabled = await elem.isEnabled();
console.log(isEnabled); // outputs: true
elem = await $('.input2')
isEnabled = await elem.isEnabled();
console.log(isEnabled2); // outputs: false
elem = await $('.input3')
isEnabled = await elem.isEnabled();
console.log(isEnabled3); // outputs: false
});