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?
thanks
Answer: To disable all input elements within div use the following code: $('#message :input'). attr('disabled', true);
Using jQuery The idea is to disable click events inside div with jQuery and CSS. This can be done by setting pointer-events CSS property with the help of jQuery's . addClass() function.
It can be be done by using prop() method. Using prop() Method: It is used to set or return the properties and values for the selected elements. Example 1: In this example, the . prop() method is used to disable all input controls inside a form element.
Nope! Divs can't be disabled. Only form and form elems. Actually in Quirks-mode IE can disable a div , but it only grays button texts, it doesn't prevent events firing.
You must traverse and disable all relevant elements.
$("#tbl").find("input,button,textarea,select").attr("disabled", "disabled");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With