Home > Web Front-end > JS Tutorial > Get the type of selected object in javascript_javascript skills

Get the type of selected object in javascript_javascript skills

WBOY
Release: 2016-05-16 19:16:00
Original
1321 people have browsed it

In Javascript, textRange can be created using document.selection. But in fact, it cannot be created at any time.
We can use document.selection.type to determine whether the currently selected text or object is selected.

document.selection.type returns three values ​​"None" "Text" "Control"

Only when the return value is Text, the created textRange is valid.

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template