• jQuery选择器,用逗号分隔的时候需要注意范围问题


    jQuery选择器,用逗号分隔的时候需要注意范围问题:

    <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
    <%
        String path = request.getContextPath();
        String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
    %>
    <!DOCTYPE html>
    <html>
    <head>
    <base href="<%=basePath%>">
    <meta charset="UTF-8">
    <title>b index</title>
    <link rel='stylesheet' type="text/css" href='b/css/bootstrap.css'>
    </head>
    <body style="margin:150px;">
        <div>
            <input type="checkbox" info="1" id="chkTestId"><label for="chkTestId">选择框</label>
            <input type="checkbox" info="2" id="chkTest2Id"><label for="chkTestId">选择框2</label>
            <button id="btnClickId">click me</button>
            <input type="hidden" value="hiddenValue">
        </div>
        <div>
            <table id="tblFormId">
                <tr>
                    <td><input type="text" id="txtIn01Id"></td>
                </tr>
                <input type="text" id="txtIn02Id" >
            </table>
            <button id="btnUnderTblId">click me</button>
        </div>
        <script type="text/javascript" src="js/jquery-1.11.1.js"></script>
        <script type="text/javascript" src="b/js/bootstrap.js"></script>
        <script type="text/javascript" src="js/index020.js"></script>
        
    </body>
    </html>

    $('#tblFormId input,input[type=hidden]')选择结果为:

    <input type="hidden" value="hiddenValue"><input type="text" id="txtIn01Id">

    选择器中的逗号是两个条件的合集,第一个条件中的空格前面的部分不能带到下一个选择器中,

    所以原来的意思是:$('#tblFormId input,#tblFormId input[type=hidden]')

  • 相关阅读:
    模板语言的作用及实例
    模板语言
    轮播图实例
    render,render_to_redponse,locals,redirect重定向
    setting中三个重要参数
    python中的Celery基本使用
    python中的Redis基本使用
    DRF之JWT认证
    DRF之过滤排序分页异常处理
    DRF之权限和频率限制
  • 原文地址:https://www.cnblogs.com/stono/p/4932064.html
Copyright © 2020-2023  润新知