javascript - Detecting if HTMLInputElement.select is actually supported -


people ua sniffing bad. i'm trying feature detection htmlinputelement.select().

my reason that, on ios mobile devices, function supported, does not select text. want detect can use htmlinputelement.setselectionrange() instead.

i tried this:

function checkinputselectworks() {     var teststr = "test";     var input = document.createelement("input");     input.value = teststr;     input.select();      return input.selectionend == teststr.length; } 

jsfiddle

i thought sufficient, seems selectionend set teststr.length before calling select(). how should go doing this?

no jquery, please. shouldn't necessary.

edit: adding input element dom did not help. input.selectionend becomes 0 when added dom, still gets updated after .select() on ios without selecting text.


Comments