The jQuery library contains many methods for changing and operating HTML elements and their attributes. One of the most important parts is that jQuery can be used to operate the DOM. This article describes how to use jQuery to obtain the values or attributes of DOM node elements. Three simple and useful methods are as follows: text ()-set or retrieve the text content of a specified element. Html ()-set or retrieve the content of a specified Element (including HTML tags) val ()-set or retrieve the value of an input field in the form. For example, the following code uses the html () and text () methods to obtain the content of HTML elements: [javascript] $ ("# btn1 "). click (function () {alert ("Text:" + $ ("# test "). text () ;}); $ ("# btn2 "). click (function () {alert ("HTML:" + $ ("# test" example .html () ;}); $ ("# btn1 "). click (function () {alert ("Text:" + $ ("# test "). text () ;}); $ ("# btn2 "). click (function () {alert ("HTML:" + $ ("# test" ).html () ;}); the following code retrieves the Input content in Form: [javascript] $ ("# btn1 "). click (function () {alert ("Va Lue: "+ $ (" # test "). val () ;}); $ ("# btn1 "). click (function () {alert ("Value:" + $ ("# test "). val () ;}); apart from the preceding method, the attr () method is used to obtain the attributes of an element. The following code is used to obtain the href attribute of the link: [html] <! DOCTYPE html>