For my study only

Today is the DOM in JS, jquery introduction. Jquery has a lot of stuff and is a bit annoying

The DOM model

DOM stands for Document Object Model

The Document object:

  1. Document manages the content of all HTML documents.
  2. Document is a tree structured document. There is hierarchy.
  3. It allows us to objectify all the labels
  4. We can access all tag objects through document.

This feeling is very useful.

The query object

Document.getelementbyid (elementId) Finds the tag DOM object by its ID attribute, which is the value of the tag’s ID attribute

Document. GetElementsByName (elementName) through the tag’s name attribute to find dom object, elementName tag’s name attribute value

Document. GetElementsByTagName (tagname) label dom object via the tag name. Tagname is the label name

The document.createelement (tagName) method creates a tag object with the given tagName. TagName is the name of the tag to be created

Note that the tag object can be queried only after the page is loaded

Common attributes

FirstChild gets the firstChild of the current node lastChild gets the lastChild of the current node parentNode gets the parent of the current node nextSibling gets the next node of the current node PreviousSibling Gets the last node of the current node className used to get or set the tag’s class attribute value

InnerHTML gets/sets the contents of the start and end tags. InnerText gets/sets the text of the start and end tags

If no parameter is specified, obtain it. If no parameter is specified, set it

Jquery

Jquery’s core function $

Is the core function of jQuery and can accomplish many functions of jQuery. Is the core function of jQuery and can accomplish many functions of jQuery. Is the core function of jQuery and can accomplish many functions of jQuery. () calls the $function

1. When the parameter is [function], it indicates that the page is loaded. Function (){function(){function(){function(){function(); Id selector, query label object (” label name “) by ID; Tag name selector, according to the specified tag name query tag object $(“.class attribute value “); [DOM object]; convert this DOM object to jQuery

The jquery object

The essence of jQuery objects is

Dom object array + jQuery provides a series of functions.

Converts to and from DOM objects

JQuery objects cannot use the properties and methods of DOM objects and DOM objects cannot use jQuery

$(dom) = $(dom); $(dom) = $(dom); $(dom) = $(dom) Object [subscript] retrieves the corresponding DOM object

Jquery selector and element filtering

There is a lot of knowledge here, so it’s best to consult the documentation when you use it.