I'm having an issue in IE7 and below where a form that I'm toggling the display of via $.slideUp()
& $.slideDown()
, has an disappearing textarea.
This is the form code:
<% using (Html.BeginForm("AddComment", "Comment", FormMethod.Post, new { id = "addCommentForm", @class = "comments-form" }))
{ %>
<input type="hidden" name="SiteID" value="<%: Model.Name %>" />
<table>
<colgroup>
<col class="comments-form-text" />
<col class="comments-form-submit" />
</colgroup>
<tbody>
<tr>
<td>
<textarea name="Text" rows="2" cols="75"></textarea>
</td>
<td>
<div>
<input type="submit" value="Add Comment" />
</div>
</td>
</tr>
</tbody>
</table>
<% } %>
I'm toggling the display on a button click in javascript (using jQuery) with: $('#addCommentForm').slideDown();
My issue is that in IE7 and below, the text area disappears when the form has finished sliding down. It only reappears when I most over the submit button (which has been styled using jQueryUI .button()
method).
When I say disappears, it's gone. Looking at the html in the IE Dev Tools, it's html is still there, it's just not being rendered at all.
As much as I absolutely hate IE, I am required to support it :(
Anyone have any ideas why this is happening? Or how I can mitigate it?
display = "none" will make it disappear when clicked on div.
If you don't want an element to display on an element at all, you can set the value of the display property to none. The following style rule hides an element on a web page: display: none; When you set the value of display to none, the affected element will disappear.
You cannot place HTML elements inside a text area, only text content. only text content covers that part.
There are some ways of solving this problem:
span
instead of a div
element to
slideDown. Might be an IE's rendering
bug;zoom:1;
in your CSS to the element you're
trying to slideDown;min-height
to your sliding element in
your CSS;Setting a width on the element will solve the problem. All of @paulillo solutions work well but setting the width will help protect you from other related bugs.
slideDown temporarily sets the position to absolute, which sometimes produces a bug known as the "jump" bug. This happens because sometimes slideDown can't accurately calculate the height when the element width is altered in the brief moment its absolute. I hate setting width unless I have to but in this case, if you can, I would recommend it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With