jQuery 1.4 Reference Guide
上QQ阅读APP看书,第一时间看更新

Form selectors

The following selectors can be used to access form elements in a variety of states. When using any of the form selectors other than :input, providing a tag name as well is recommended (for example, input:text rather than :text).

  • Form element (:input): Select all form elements (<input> (all types), <select>, <textarea>, <button>)
  • Text field (:text): Select all text fields (<input type="text">)
  • Password field (:password): Select all password fields (<input type="password">)
  • Radio button (:radio): Select all radio button fields (<input type="radio">)
  • Checkbox (:checkbox): Select all checkbox fields (<input type="checkbox">)
  • Submit button (:submit): Select all submit inputs and button elements (<input type="submit">, <button>)
  • Image button (:image): Select all image inputs (<input type="image">)
  • Reset button (:reset): Select all reset buttons (<input type="reset">)
  • Standard button (:button): Select all button elements and input elements with a type of button (<button>, <input type="button">)
  • File upload (:file): Select all file upload fields (<input type="file">)
  • Enabled form element (:enabled): Select all form elements that are enabled (that is, they do not have the disabled attribute and users can interact with them)
  • Disabled form element (:disabled): Select all form elements that are disabled (that is, they have the disabled attribute and users cannot interact with them)
  • Checked box (:checked): Select all form elements—checkboxes and radio buttons—that are checked
  • Selected option (:selected): Select all form elements (effectively, <option> elements) that are currently selected