开发者

Boolean Attributes with jQuery is inconsistent accross Browsers

I create an attribute called "hasAgreed" to check whether I should treate or dismiss the values of a form. I used this instead of relying on the click of the OK button since I want to be able to close the form sometimes when the user press Enter in the text input.

The problem I have is that if I do $('#formElement').attr('hasAgreed'), I get diff开发者_如何转开发erent values.

Firefox returns a string "true" ( $('#formElement').attr('hasAgreed') == 'true') IExplorer returns a boolean true, ($('#formElement').attr('hasAgreed') == true) Chrome seems to be fine with both versions.

Is there a way to set a bool value using the attr() function of jQuery so that is consistent accross multiple browsers?

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜