如何禁用使用jQuery的div或表中的所有元素 [英] How to disable all Element inside a div or table using jQuery

查看:1758
本文介绍了如何禁用使用jQuery的div或表中的所有元素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含多个文本框和buttons.I使用jquery这个code禁用我的表的表:

I have a table that contains several text box and buttons.I disable my table using jquery by this code:

 $("#tbl").attr("disabled", "disabled");

我的表被禁用,但是当我双击该按钮之成为能和我可以在文本框中输入过多的字符。如何禁用表中的所有控制?

my table become disabled but when I double click on the button it become enable and I can enter characters in my text box too. How I can Disable all control inside a table?

感谢

推荐答案

您必须遍历并禁用所有相关的元素。

You must traverse and disable all relevant elements.

$("#tbl").find("input,button,textarea,select").attr("disabled", "disabled");

这篇关于如何禁用使用jQuery的div或表中的所有元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆