开发者

jquery fadein wont work on IE8

I have a span wrap in a td. I set my span css to display none. When trigger my js function to display using fadein, it won't work on IE8 but works perfectly on 7 and 9. Below is my code.

CSS code

.noansError{border: 1px solid #a51b1b; padding: 0 0 0 2px; background: #f8a1a1; color: #a51b1b; font-size: 14px; display: none;}

HTML code

<td><span id="errorNoAns1" class="noansError">Please An开发者_如何学Cswer</span><input id="q1" type="text"/></td>

MY jquery

$('#q1').css('display','none');
$('#errorNoAns1').fadeIn(300);

id errorNoAns1 is the span that wont fadein on ie8


Whew! Ive got it, after a few hours of twiks and searching. I found out the you need to have a relative position on you parent element. I just added position relative on my td where the span is wrap.


I think jQuery's fadeIn(), fadeOut() function can only show/hide block element, you can set the .noansError{ display:block } to have a try.


$('#errorNoAns1').hide().fadeIn(300); might fix it, but it's a bit hacky.


try

$('#q1').hide()

ie has some problem about attribute setting

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜