If a textarea is wrap()ed in a new div on, IE7 will forget its value
when
browsing back and forth the browser history. Not sure if the same
error
happens on IE6 as well. It definitely does not happen on firefox or
konqueror.

An obvious workaround would have been to get the value of the
textarea before applying the wrap() and restore it later. But for some
reasons
that does not work out. Maybe there is some wired javascript
optimization
going on in IE7. Only the presence of wrap() later in the code will
null the textarea's value.

To reproduce this error, copy the text below into a html test page.

Then proceed as follows:

1. Type some text into the textarea:

<textarea id="textarea" rows="5" cols="22">
</textarea>

2. Click on this button:
<button onclick="window.location.href='/';">Go away</button>

3. Hit the "back" button of your browser. In a standard-compliant
browser the textarea should still contain the text you inserted. An
alert
message should pop up reporting this value.

4. Try commenting out the line mentioned in the javascript code below
and try again to verify that this is really the wrap() command.

<script type="text/javascript">
$(function() {
  $("#textarea").each(function() {
    var val = this.value;
    if (val !='' ) {
      alert("found val="+val);
    } else {
      alert("textarea is empty");
    }
    $(this).wrap("<div></div>'"); // try commenting out this line
  });
});
</script>

Reply via email to