jQuery中的:input选择器

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

<!DOCTYPE html>
<html >
<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 ></div>

    <script src="jquery-2.1.4.js"></script>
    <script>
        $("#messages").text($(":input").length+":"+$("form>*").length)
    </script>

</body>
</html>

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