javascript - Jquery .val() doesn't work on firefox -


i have textarea user can type comment , press enter submit comment , after textarea's text should cleared , placeholder should appear used function

<tr id="sc-1-comment" style="background-color:white;"> <td colspan="2">     <textarea id="id_comment_to_post-1" name="comment" style="resize: none; vertical-align: middle;" placeholder="leave comment..."          onkeydown="         if (event.keycode == 13 && !event.shiftkey)          {             event.preventdefault();             new_comment('commentsinnerhtml-1', '1',document.getelementbyid('id_comment_to_post-1').value);              $('#id_comment_to_post-1').val('');         }         "></textarea> </td> 

in chrome , ie works in firefox, ends clearing text , inserting new line in textarea , placeholder won't appear there new line in textarea.

any suggestions?

try vanilla javascript approach, keep nice , simple.

document.getelementbyid("text-area-id").value = ''; 

can't imagine why wouldn't work.


Comments

Popular posts from this blog

java - Run a .jar on Heroku -

java - Jtable duplicate Rows -

validation - How to pass paramaters like unix into windows batch file -