title: Is there any alternative method for isTextSelected() in jquery or javascript.?
body: <p>Is there any alternative method for the <a href="http://www.scratchinginfo.net/how-to-find-out-if-the-text-in-a-textbox-is-selected-with-jquery/" rel="nofollow">following code</a> in jquery or javascript.?</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>function isTextSelected(input) {
    if (typeof input.selectionStart == "number") {
      return input.selectionStart == 0 &amp;&amp; input.selectionEnd == input.value.length;
    } else if (typeof document.selection != "undefined") {
      input.focus();
      return document.selection.createRange().text == input.value;
    }
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;input id="text_selected" type="text" value="Select Text" /&gt;
  &lt;input onmousedown="console.log(isTextSelected(document.getElementById('text_selected')));" type="button" value="Selected or Not" /&gt;</code></pre>
  </div>
  </div>
  </p>