javascript - Check if an input item text is already selected? -


I have text input items and using selection () I can highlight text inside it, though sometimes -Every text is already a valid reason and when I run (), I think that it does not deselect it, is it possible to check that input items have been selected?

You can select to select.

You have to check that the selection is in your input items.

  var selecttxt = ''; If (window.getSelection) {selecttxt = window.getSelection (); } And if (document.getSelection) {selecttxt = document.getSelection (); } And if (document.selection) {selecttxt = document.selection.createRange () Text; } Var textofinput = [...]; // Here is the code to find text in the input if textofinput.indexOf (selecttxt)! == -1) {// Part of the text of the input / section has been selected Warning ('the conditions have been fulfilled!' ); }  

Comments

Popular posts from this blog

windows - Heroku throws SQLITE3 Read only exception -

lex - Building a lexical Analyzer in Java -

python - rename keys in a dictionary -