我在网页上有 7 个按钮。当我点击 btn7 时,我想检查有多少按钮被禁用。
<button type="submit" class="btn btn-home" name= "btn-save1" id= "btn-save1" required="required">Save</button>
<button type="submit" class="btn btn-home" name= "btn-save2" id= "btn-save2" required="required">Save</button>
<button type="submit" class="btn btn-home" name= "btn-save3" id= "btn-save3" required="required">Save</button>
<button type="submit" class="btn btn-home" name= "btn-save4" id= "btn-save4" required="required">Save</button>
<button type="submit" class="btn btn-home" name= "btn-save5" id= "btn-save5" required="required">Save</button>
<button type="submit" class="btn btn-home" name= "btn-save6" id= "btn-save6" required="required">Save</button>
JS
<script type="text/javascript">
$('document').ready(function()
{
$(document).on('click', '#btn-save7', function(e){
alert('test');
})
});
</script>
如何检查是否所有按钮都被禁用?
编辑:
我已经检查了这些链接,但这些链接是高级的,而且我对 jQuery 不太擅长。 JQuery 选择所有没有禁用且没有只读的元素?