zoukankan      html  css  js  c++  java
  • 对于JQuery中的后代和子元素的了解

    对于jquery的新手来说,后代元素和子元素的往往不是很清楚

    其实很简单,后代就是所有后代,但是子元素就是直接的后代,三世同堂,爷爷,爸爸,和你,爸爸是爷爷的子元素,你是爷爷的后代,明白了吧

    <div>This is <strong>very</strong> important.</div>

    <div>This is <em>really <strong>very</strong></em> important.</div>

    这样的样式,为了容易看到效果,我们不妨就尝试用添加css颜色来试一下

    如果运行$("div strong").css("color","red");就是把div的后代元素strong变为红色。运行后是

    This is very important.
    This is really very important.
     
    如果运行$("div>strong").css("color","blue");就是把div的子元素strong变为蓝色。运行后是
     
    This is very important.
    This is really very important.
  • 相关阅读:
    javascript 数字格式化
    spring-cloud blogs
    rabbitmq python
    centos7下 安装mysql
    hue install
    d3 document
    elastichq 离线安装
    elasticsearch agg
    elastichq auto connect
    Go Hello World!
  • 原文地址:https://www.cnblogs.com/yunfeiqi/p/2729968.html
Copyright © 2011-2022 走看看