Home > Web Front-end > JS Tutorial > body text

Getting Started with jquery—Accessing DOM Object Methods_jquery

WBOY
Release: 2016-05-16 17:44:29
Original
867 people have browsed it
1. JavaScript access DOM object method :
var oTxtValue=document.getElementById("Text1").value;
2. JQuery access DOM object method :
var oTxtValue=$("#Text1").val();
Accessing or controlling elements in the page through methods in the JQuery library is much simpler than using JavaScript code and is compatible with various browsers.
Sample code:
Copy code The code is as follows:




Controlling DOM objects
< ;META NAME="Generator" CONTENT="EditPlus">






< /HEAD>


Please enter the following information

< div class="divContent">
Name:

Gender: Male

Married status:
onclick="btnClick();">


< /div>




Rendering:
Getting Started with jquery—Accessing DOM Object Methods_jquery
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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!