Traditional Culture Encyclopedia - The 24 Solar Terms - How does jquery get the child elements of the parent element?
How does jquery get the child elements of the parent element?
Tool materials: editor, browser
1. You can get all the child elements under the selector by using the children method. The code example is as follows:
& lt! DOCTYPE? html & gt
& lthtml & gt
& lthead & gt
& lt script? type="text/javascript "? src = "/jquery/jquery . js " & gt; & lt/script & gt;
& ltstyle & gt
Body? {? Font size:16px; ? Font thickness: bold; ? }
p? {? Margin: 5px? 0; ? }
& lt/style & gt;
& lt/head & gt;
& ltbody & gt
& ltdiv & gt
& ltspan & gt Hello & lt/span>.
& ltp? Class="selected "> hello? Again & lt/p & gt;;
& ltdiv? Class="selected "> and then what? Again & lt/div & gt;;
& ltp> and then what? One? Finally? Time & lt/p & gt;;
& lt/div & gt;
& lt script & gt $ ("div"). Children (. Selected "). Css("color ","blue "); & lt/script & gt;
& lt/body & gt;
& lt/html & gt; 2. The result of running is to find the child elements of all DIVs with the class name "selected" and set them to blue. The results are as follows:
- Related articles
- Why are the 24 solar terms solar calendar?
- The origin of spring
- Old yellow calendar plus solar terms
- What is the poetry of cold food?
- Sincerely ask her daughter's name. Her father's surname is Zhou and her mother's surname is Yang. She was born in beginning of spring on February 4th, 2065438 14:54.
- Heavy snow solar terms in 2023
- Making method and formula of Qibao tea: making method and raw materials of Qibao tea.
- Meteorology of Beidaihe Tomb-Sweeping Day
- Fishing skills in windy days
- Yujie electric four-wheeled vehicle has no voltage12v.