I have a textarea where user can type a comment and press enter to submit the comment and then after that the textarea's text should be cleared and the placeholder should appear so i used this 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 a 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 and IE it works but in Firefox, it just ends up clearing the text and inserting a new line in the textarea and thus placeholder won't appear as there is a new line in the textarea.
Any suggestions?