开发者

How should disabled <div> act?

开发者 https://www.devze.com 2023-03-12 05:04 出处:网络
I noticed the following bug when using $(selector).children().attr(\"disabled\", \"disabled\") 开发者_如何学Pythonwhere the children happened to contain a <div>.

I noticed the following bug when using $(selector).children().attr("disabled", "disabled") 开发者_如何学Pythonwhere 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)


<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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号