title: document.getSelection() not working on iOS chrome/safati
body: <p>The problem that i'm having is that on iOS it seems like i cannot get the selection from the textarea. The same code on PC works well, and i can see the same text in the two alerts (range and sel, see code): on iOS unfortunately I see what i expect iun the 'range' alert but i see nothing in the 'sel' range (just the actual &quot;sel :&quot;).
  <br>
  I tried almost every type of check possible and read all the existing documentations (i think at lest) before writing here so this is kinda my last resort<br><br>also the code is crappy, im sorry, just need this to work on mobile</p>
  <pre><code>                    // text area method
                      let textArea = document.createElement(&quot;textarea&quot;);
                      document.body.appendChild(textArea);
                      $(textArea).html(textToCopy);
                      // make the textarea out of viewport
  
                      textArea.style.position = &quot;absolute&quot;;
                      textArea.style.opacity = 0; //tried without this, didnt work
                      textArea.style.left = &quot;-999999px&quot;;
                      textArea.style.top = &quot;-999999px&quot;;
  
                      //tried with this, didnt work
                      textArea.contentEditable = true;
                      textArea.readOnly = false;
  
                      $(textArea).css(&quot;user-select&quot;, &quot;text&quot;);
                      $(textArea).css(&quot;-webkit-user-select&quot;, &quot;text&quot;);
  
                      /*textArea.focus();*/
  
                      var selection = document.getSelection();
                      var range = document.createRange();
                      range.selectNodeContents(textArea);
                      alert(&quot;range: &quot; + range)
                      selection.removeAllRanges();
                      selection.addRange(range);
  
                      alert(&quot;sel: &quot; + selection.toString())
  
                      //tried with this, didnt work
                      /*textArea.setSelectionRange(0, 999999);*/
  
                      document.execCommand('copy')
                      textArea.remove();
  </code></pre>