zoukankan      html  css  js  c++  java
  • JQuery学习(选择器-基本-*)

     1 <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
     2 <%
     3     String path = request.getContextPath();
     4     String basePath = request.getScheme() + "://"
     5             + request.getServerName() + ":" + request.getServerPort()
     6             + path + "/";
     7 %>
     8 
     9 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    10 <html>
    11 <head>
    12 <base href="<%=basePath%>">
    13 
    14 <title>My JSP 'jquery.jsp' starting page</title>
    15 
    16 <meta http-equiv="pragma" content="no-cache">
    17 <meta http-equiv="cache-control" content="no-cache">
    18 <meta http-equiv="expires" content="0">
    19 <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    20 <meta http-equiv="description" content="This is my page">
    21 <script type="text/javascript" src="/common/easyui/jquery.min.js"></script>
    22 <script type="text/javascript">
    23     $(document).ready(function(){
    24     $("*").css("color","red");
    25     });
    26     
    27 </script>
    28 
    29 </head>
    30 <body>
    31 <form>
    32   <div>DIV</div>
    33 <span>SPAN</span>
    34 <p>P</p> 
    35 </form>
    36 </body>
    37 </html>

          运行效果图1-1

    重点解释:

    $("*"):找到每一个元素
    注释:
    JQueryAPI中类似的还有

    class:根据给定的类匹配元素
    $(".myClass"):查找所有myClass类

    element:根据元素名匹配元素
    $("div"):查找所有div元素

    id:根据指定的ID匹配一个元素
    $("#myDiv"):查找名字为myDiv的元素

    select1,select2,selectN:将每一个选择器匹配到的元素合并后一起返回。
    $("div,span,p.myclass"):返回div元素,span元素和名字为myclass的p元素
  • 相关阅读:
    逆向工程IL指令集
    关于最近电话面试的体会
    推荐阅读《小就是大》(small is the new big)
    [ZZ]google v. microsoft, and the dev:test ratio debate
    我所用到的Google产品
    [ZZ]7 Useful Tools for Web Development Testing
    拼车新模式
    [ZZ]读《移山之道》后有感
    Google财经香港版上线,香港路演
    [ZZ]从Google到“谷歌”
  • 原文地址:https://www.cnblogs.com/2296bbs/p/5361114.html
Copyright © 2011-2022 走看看