How to compare if string has a enter key in the end using jquery/javascript?
- by user144842
I have a string value from a user input box. I have to figure out if last char is a enter key (line feed).
Thats the code. Here I am checking if last char has a whitespace. Now I also have to check if last char is enter key (carriage return or line feed). How can i do this?
var txt = $get("<%= txtUserText.ClientID %>");
if (txt.value.substring(txt.value.length -1) !== ' ' || <checkifLastCharIsEnterKey>)
//my code to take action
**I don't think i need a keypress or keyup event because this above piece of code is not invoked at the time of user input.