How do i disable enter key within a texbox or textarea using javaScript

How do i disable enter key within a texbox or textarea using javaScript.

Thanks

Posted by:

Comments History


by: on
 
by: on
thanks Saqib
 
by: on
Thanks for share ..
 
by: on
dfgdf
 
by: on
Thanks. Was of great help
 
by: on
$('textarea').keypress(function(event) {
if ((event.keyCode || event.which) == 13) {
    event.preventDefault();;
    return false;
  }
});
$('textarea').keyup(function() {
	var keyed = $(this).val().replace(/\n/g, '<br/>');

	$(this).html(keyed);

}); 

solution source: How can I disable the ENTER key on my textarea?


 

Name :  

Email :  

Comment Below