开发者

<button> in IE7

开发者 https://www.devze.com 2023-04-05 08:36 出处:网络
I tried a few simple jQuery manipulation on <button> tags but, for some reasons, didn\'t work on IE7.

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?


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


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.

0

精彩评论

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

关注公众号