Retain user selected text on blur/focus
How can I retain the user's text selection when calling $(inputElement).focus()
on some text input element, inputElement
, so that they can still use Ctrl+C after inputting some text top their initial selection?
I have considered intercepting the $(document).blur(...)
event and preventing propagation to keep the selected text, but I'm not sure if it will work across all major browsers, if at 开发者_StackOverflowall.
if i didn't misunderstood...
you can use window.storage
or document.cookie
(in case window.storage is un available)... when the user input text in the field you can store its value(onBlur) against an id and on ctrl+C retrieve the value and put it else where (in case of ctrl+z)
精彩评论