zoukankan      html  css  js  c++  java
  • jquery层级原则器(匹配后代元素div)

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
     <head>
      <title>层级 </title>
      <meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
      <script  type="text/javascript" src="jquery-1.7.1.min.js"></script>
      <script type="text/javascript">
      /*
      ancetor descendant:匹配祖先元素下的后代元素
      parent>child:匹配父元素下的子元素
      prev+next:匹配前一个元素后的下一个元素,必须是挨着的
      prev~siblings:匹配前一个元素后的所有平辈元素
      */
            window.onload=function(){
                $('#btnOk').click(function(){
                   //匹配后代元素div
                    $('#index div').html('php');
                });
            };
      </script>
     </head>
     <body>
         <div id='index'>
                <div>div1</div>
                <form>
                    <div>div2</div>
                    <div>div3</div>
                </form>
                <div>div4</div>
                <div>div5</div>
        </div>
        <div>yang</div> <!--该元素没有再id=index下的div中-->
        <hr/>
      <input type="button" id='btnOk' value='确定'  />
     </body>
    </html>
  • 相关阅读:
    CF Spreadsheets (数学)
    CF Theatre Square
    CF Error Correct System
    CF Playing with Paper
    HDU 3533 Escape (BFS + 预处理)
    nginx配置文件
    nginx配置文件详解
    Jenkins+maven+gitlab+shell实现项目自动化部署
    jenkins升级
    jenkins相关下载链接
  • 原文地址:https://www.cnblogs.com/yangzailu/p/5841133.html
Copyright © 2011-2022 走看看