I have a Bootstrap modal with a textarea in it. When you open the modal, the textarea needs to be cleared of any previous text so it’s fresh every time you open it.
The problem is, the placeholder on the field is also removed the first time you clear the text.
I am using $('textarea').val('') to clear the text.
You need to trigger the
blurevent for the placeholder to appear again. And it works only during the hide event, so that when it appears again the placeholder is put back.working jsfiddle
EDIT: I was wrong, it seems that it works without the blur by just changing the event from
showtohideas explained by Martin in his answer where he uses the eventshown