开发者

Disabled cell's button click event fire

I have a table in which there is a butt开发者_如何学Pythonon in one cell. Now when I am disabling that cell, the cell gets disabled but on clicking upon that cell, button click event is happening. So instead of disabling the cell, I disabled the button. Now everything working fine, but I wanted to know that why on disabling the cell, button click event was getting fired? my code snippet is like below:

To disable cell-(previous approach) ---

grid.rows[i].cells[1].disabled=true;

To disable button:(new approach)--

grid.rows[i].cells[1].firstChild.disabled=true;


From the html4 spec:

The following elements support the disabled attribute: BUTTON, INPUT, OPTGROUP, OPTION, SELECT, and TEXTAREA.

Looking at the html4 spec for td, there is nothing saying disabled is valid.

So that means setting disabled on the table's cell does nothing. You need to set individually on the form elements inside of the cell.

What you are doing now is randomly setting some property on the cell that means nothing to it. It is the same thing as setting grid.rows[i].cells[1].foobar=true;. It means nothing, but the cell has it attached to it.


I think it maybe happening because when u disable the cell then the button element does not get disabled. It still remains enabled, unlike the cell.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜