<button> in IE7

六眼飞鱼酱① 提交于 2020-01-05 10:34:52

问题


I tried a few simple jQuery manipulation on <button> tags but, for some reasons, didn't work on IE7.

<!-- HTML -->
<button class="button">Hello</button>

// jQuery, using v1.4.4
$('button').html('Hello World!');         // Works on Firefox and IE7.
$('button').addClass('another-class');    // Works on Firefox; *not* on IE7.
$('button').wrapInner('<span></span>');   // Works on Firefox; *not* on IE7.

Does anyone have any clues about this?


回答1:


The button tag isn't fully supported on IE6 and IE7. It isn't related to jQuery, but about the tag itself, as described here: What disadvantages are there to the <button> tag?.




回答2:


I don't see a method named .innerWrap() in jQuery. I see one named .wrapInner(). If I switch your code to .wrapInner(), it works for me in this jsFiddle in IE9 and in IE9 in IE8 and IE7 emulation mode. I don't have the actual IE7 available to try here, so perhaps part of the issue is the partial support in IE7 for the button tag.



来源:https://stackoverflow.com/questions/7456578/button-in-ie7

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!