javascript - Text Area in JSP Enter to implement a functionality -


i using spring mvc , have created textarea in it, want add functionality: when user presses 'enter' 2 times cursor automatically go next line , indicate paragraph number in new line:

here code textarea:

<textarea   name="notings" style="width:800px ; height:200px" ></textarea> 

example:

  1. users types ... ................................ //presses enter key 2 times consecutively

  2. types else....

i clueless in implementing functionality. starter @ front end development , don't know javascript well. little appreciated.

if point me towards right direction, alot

thanks in advance

you try way

<html> <head>     <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>     <script>     var pn=1;         var count=0;     function newlinefun(e)     {     if(e.keycode==13)         {         count++;         if(count==2)         {         count=0;         var olddata=$("#txtarea").val();         $("#txtarea").val(olddata+pn);         pn++;         }         }         else{         count=0;         }      } </script> </head> <body> <textarea  id="txtarea" name="notings" style="width:800px ; height:200px" onkeypress="newlinefun(event)"></textarea> </body> </html> 

Comments

Popular posts from this blog

html - Firefox flex bug applied to buttons? -

html - Missing border-right in select on Firefox -

python - build a suggestions list using fuzzywuzzy -