• 对于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.
  • 相关阅读:
    C#中平方与n次方
    哈希算法
    C#QQ邮箱发送消息
    C#Unicode和Utf-8
    timeStamp(时间戳)
    GetHashCode
    获取XML中指定属性的值
    MySQL基础之创建和操纵表
    django基础之Django模型
    django基础之Django简介
  • 原文地址:https://www.cnblogs.com/yunfeiqi/p/2729968.html
Copyright © 2020-2023  润新知