What is meaning of following code, I want to convert in to jquery for browser compatibility.
document.selection.createRange().text
What is meaning of following code, I want to convert in to jquery for browser compatibility.
document.selection.createRange().text
document.selection
is an IE-specific legacy way to get text that the user has "selected" (highlighted with the mouse) on a web page.
It's now deprecated in favour of the standards-based document.getSelection()
- see the MDN documentation for more info.
There are already jQuery plugins that make this cross-browser, e.g jquery-textrange