title: How to compare if string has a enter key in the end using jquery/javascript?
body: <p>I have a string value from a user input box. I have to figure out if last char is a enter key (line feed).</p>
  
  <p>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?</p>
  
  <pre><code>var txt = $get("&lt;%= txtUserText.ClientID %&gt;");
  if (txt.value.substring(txt.value.length -1) !== ' ' || &lt;checkifLastCharIsEnterKey&gt;) 
    //my code to take action
  </code></pre>
  
  <p>****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.**</p>