Home >Web Front-end >JS Tutorial >Getting Started with jquery—Accessing DOM Object Methods_jquery

Getting Started with jquery—Accessing DOM Object Methods_jquery

WBOY
WBOYOriginal
2016-05-16 17:44:29916browse
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
Statement:
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