jQuery contains powerful methods for changing and manipulating HTML elements and attributes.
One very important part of jQuery is the possibility to manipulate the DOM.
jQuery comes with a bunch of DOM related methods that make it easy to access and manipulate elements and attributes.
| DOM = Document Object Model The DOM defines a standard for accessing HTML and XML documents: "The W3C Document Object Model (DOM) is a platform and language-neutral interface that allows programs and scripts to dynamically access and update the content, structure, and style of a document." |
Three simple, but useful, jQuery methods for DOM manipulation are:
The following example demonstrates how to get content with the jQuery text() and html() methods:
The following example demonstrates how to get the value of an input field with the jQuery val() method:
The jQuery attr() method is used to get attribute values.
The following example demonstrates how to get the value of the href attribute in a link:
The next chapter explains how to set (change) content and attribute values.
For a complete overview of all jQuery HTML methods, please go to our jQuery HTML/CSS Reference.
The perfect solution for professionals who need to balance work, family, and career building.
More than 10 000 certificates already issued!
The HTML Certificate documents your knowledge of HTML.
The HTML5 Certificate documents your knowledge of advanced HTML5.
The CSS Certificate documents your knowledge of advanced CSS.
The JavaScript Certificate documents your knowledge of JavaScript and HTML DOM.
The jQuery Certificate documents your knowledge of jQuery.
The XML Certificate documents your knowledge of XML, XML DOM and XSLT.
The ASP Certificate documents your knowledge of ASP, SQL, and ADO.
The PHP Certificate documents your knowledge of PHP and SQL (MySQL).
Your message has been sent to W3Schools.