问题
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