标签:message str mit pop i++ style string addclass lines
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 选择器选中。
标签:message str mit pop i++ style string addclass lines
原文地址:http://www.cnblogs.com/clnchanpin/p/7225493.html