I noticed the following bug when using $(selector).children().attr("disabled", "disabled")
where the children happened to contain a <div>
.
Fiddle
<div disabled="disabled">
<input type="text" value="RAGE" />
</div>
Basic testing says FF4/Chrome enable the field. IE9 disables the field.
What is the expected behaviour?
Same for any other non form element (<input>
, <select>
, etc)
disabled isn't a valid property for div .
People also ask. How do you disable onClick event of div in react? The above code makes the contents of the div disabled, You can make the div disabled by adding the disabled attribute. Upon clicking the button you can change the state variable disabled as 'true'.
To disable div element and everything inside with CSS, we set the pointer-events CSS property of the div to none . to disable pointer events on the div with pointer-events set to none with CSS.
Div element cannot be disabled like form controls. You can disable form controls in div instead.
<div>
elements do not have a disabled
attribute according to the HTML specification. The expected behavior is to prevent your markup from validating correctly.
However, the new HTML5 specification allows for <fieldset>
to have a disabled
attribute, which disables any nested input fields. It's not widely supported yet though, so you won't be able to rely on this feature for a while.
There is no disabled
attribute for the div
element. So it should have no effect.
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