JD Isaacks
JD Isaacks

Reputation: 57974

Strange behavior with arabic chars and jQuery

Here is an example of what I am talking about: http://jsfiddle.net/DNhwG/

In the example I have a textarea with arabic chars in it. When you click the button it adds some more arabic chars to the textarea and alerts the text of the textarea.

This will work fine until you manually put chars into the text area. Once you do that, it becomes out of sync.

What I mean is, the text you see in the textarea is wrong, the text in the alert is correct, and if you inspect the element, it tells you the same thing as the alert. You can no longer set the text with jQuery, well you can, and the dom will update, but the screen won't.

This is happening for me in Chrome.

Is this a known issue?

Upvotes: 0

Views: 211

Answers (1)

antishok
antishok

Reputation: 2910

You used .text() and .html() when you should be using .val() (the docs for .text() and .val() mention this regarding textfields/textareas)

Updated fiddle: http://jsfiddle.net/DNhwG/1/

Upvotes: 1

Related Questions