title: How to split the value of a textarea with the cursor position as the last line
body: <p>I want to split the value of a textarea with <code>\n</code> and make the line where the cursor is positioned as the last value in the array for example:</p>
  
  <pre><code>1. fyg tgiyu rctvyu cuiby cutv cutrvyb crtvyb
  2. rutyu rtcvyb ctrvybu ctrvybu rtcvy
  3. rutiyu crtvyu crtvyb rtvyb
  4. |
  5. tgyho8uji vtybui
  6. tvybui yivtubi
  </code></pre>
  
  <p>Now the numbers are the lines in the textarea and line 4 is the line where the cursor is positioned. so I want to split the lines ignoring line 5 and 6 have line 4 as the last line. Then I will run a code like this:</p>
  
  <pre><code>lastLine = //the position of the cursor
  if(lastLine == ""){
      console.log('empty');
  } else {
      //get the value of the previous line before the lastLine
  }
  </code></pre>
  
  <p>Please how do I achieve this using jQuery or JavaScript</p>