Skip to main content

Bug Tracker

Side navigation

#11723 closed bug (invalid)

Opened May 07, 2012 10:06PM UTC

Closed May 07, 2012 10:09PM UTC

Last modified May 07, 2012 10:41PM UTC

Changing text in textarea inside of focus event crashes IE 7/8

Reported by: christopher.roush@cerner.com Owned by:
Priority: undecided Milestone: None
Component: unfiled Version: 1.7.2
Keywords: Cc:
Blocked by: Blocking:
Description

After setting a focus event on a textarea element and changing the text of that element, as soon as text is entered from keyboard input, IE 7/8 will crash.

After the focus event is finished running the below code, any additional keyboard input will cause IE to crash. It does not seem to get stuck in any loops...it crashes immediately.

$('#textarea').focus(function(){
   $(this).text("");
   $(this).css("color","#000");
});

Changing the above code block to this example seems to solve the problem.

$('#textarea').focus(function(){
   document.form.textarea.value = "";
   $(this).css("color","#000");
});
Attachments (0)
Change History (4)

Changed May 07, 2012 10:09PM UTC by dmethvin comment:1

resolution: → invalid
status: newclosed

The equivalent to document.form.textarea.value = ""; is $(this).val(""); because textareas have values, not child text nodes.

Changed May 07, 2012 10:11PM UTC by anonymous comment:2

Is there a reason or explanation as to why it would crash IE, but work in other browsers?

Changed May 07, 2012 10:12PM UTC by dmethvin comment:3

Lots of invalid things don't work consistently across browsers. Use the value property of a textarea.

Changed May 07, 2012 10:41PM UTC by anonymous comment:4

Thanks, this worked as well. However, I logged this issue as a bug because it crashed the browser. I would expect it to fail gracefully.