zoukankan      html  css  js  c++  java
  • jQuery中的:input选择器

    jQuery中的:input选择器

    jQuery中的:input选择器包含input, textarea, select 和 button这些标签。

    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>Document</title>
        <style type="text/css">
            ul {
                margin-left: 20px;
                color: blue;
              }
              li {
                cursor: default;
              }
              span {
                color: red;
              }
        </style>
    </head>
    <body>
    
    <form>
      <input type="button" value="Input Button">
      <input type="checkbox">
      <input type="file">
      <input type="hidden">
      <input type="image">
      <input type="password">
      <input type="radio">
      <input type="reset">
      <input type="submit">
      <input type="text">
      <select>
        <option>Option</option>
      </select>
      <textarea></textarea>
      <button>Button</button>
    </form>
    <div id="messages"></div>
    
        <script src="jquery-2.1.4.js"></script>
        <script>
            $("#messages").text($(":input").length+":"+$("form>*").length)
        </script>
    
    </body>
    </html>

    所以结果为form中的全部元素都会被 :input 选择器选中。

  • 相关阅读:
    sql注入之payload
    cve2019-0708漏洞复现
    xss学习
    kernel panic not syncing
    nodeJS爬虫
    JS刷题自制参考知识
    HTML Cookie
    点击按钮触发div颜色改变的几种写法
    Bootstrap4布局(简要)
    jQuery实现论坛发帖Demo
  • 原文地址:https://www.cnblogs.com/clnchanpin/p/7225493.html
Copyright © 2011-2022 走看看