Categories

:readonly Selector

Categories: Forms

:readonly

Plugin: jQuery.expr

Description: Selects all elements that are readonly.

  • :readonly

    version added: 1.0

The :readonly selector works for input, textarea, select and button elements.

  • Finds all readonly input elements.

    HTML:
    <form>
      <input type="button" value="Input Button"/>
      <input type="checkbox" />
    
      <input type="file" />
      <input type="hidden" />
      <input type="image" />
    
      <input type="password" readonly="readonly" />
      <input type="radio" />
      <input type="reset" />
    
      <input type="submit" />
      <input type="text" readonly="readonly" />
      <select><option>Option</option></select>
    
      <textarea></textarea>
      <button>Button</button>
    </form>
    Code:
    $(':input:readonly');
    // results only the password and text input