Home > Web Front-end > JS Tutorial > Call the focus of the DOM object to give the text box focus_jquery

Call the focus of the DOM object to give the text box focus_jquery

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-05-16 16:59:14
Original
1110 people have browsed it

Since the object obtained in JQuery is still a JQuery object, using focus() on it only causes the object to obtain the onFocus() function, not the object to obtain focus. Therefore, to enable the object to obtain focus, the focus method of the DOM object should be called, that is:

Copy code The code is as follows:

$("#id")[0].focus( ;

$("#id").focus();
$("#id")[0].focus();
Related labels:
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