jquery prepend to textarea text()

Posted by synapz on Stack Overflow See other posts from Stack Overflow or by synapz
Published on 2010-06-06T03:30:40Z Indexed on 2010/06/06 3:32 UTC
Read the original article Hit count: 438

Filed under:
|
|
|

I have a text area. I can set the text of it with

$("#mytextarea").text("foo")

I can prepend to the text area like this:

$("#mytextarea").prepend("foo")

But I cannot prepend to the jquery text() object like this:

$("#mytextarea").text().prepend("foo")

The reason I want to do this is so that if my user gets me to prepend this text:

$("#mytextarea").prepend("<script>alert('lol i haxed uuu!')</script>")

...the script executes and I lose.

Help?

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about text