IE11 + jQuery 1.8.3: dynamically added textarea with placeholder has text set to placeholder
Asked Answered
R

2

3

This is very likely a bug, but I'm reporting it here for reference and for the slight chance of someone being able to propose a workaround.

IE 11 supports the placeholder attribute natively on textarea elements. That's great. But adding a new textarea with a placeholder to the DOM, it automatically puts the placeholder text into the textarea's field, too!

Here's the repro: http://jsfiddle.net/wE577/1/

Reverberatory answered 29/4, 2014 at 21:2 Comment(0)
R
3

Fiddling around on jsfiddle, it turns out that from jQuery 1.9 onwards, this problem does not occur: http://jsfiddle.net/wE577/2/.

A weird problem indeed. Unfortunately, my google foo didn't turn up any bug reports on this.

Since at the moment, we cannot upgrade jQuery beyond 1.8.3 (although I hope we soon will), a workaround I came up with is setting the placeholder attribute after adding the new textarea element to the DOM, which works flawlessly.

Reverberatory answered 29/4, 2014 at 21:2 Comment(0)
U
0

We are using jquery version 1.10.1 but still facing the issue,

<textarea placeholder='Max 250 characters'>Max 250 characters</textarea>

For this we emptied the value of textarea while clicking (or calling), like this

$('#textareaID textarea').val('');
Underwear answered 5/7, 2017 at 9:1 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.