Categories

:changed Selector

Categories: Forms

:changed

Plugin: jQuery.expr

Description: Selects all input, textarea, select and button elements which have a changed value.

  • :changed

    version added: 1.0

The :changed selector basically selects all form controls which value was different to the default value on startup.

  • Finds all changed 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" />
      <input type="radio" />
      <input type="reset" />
    
      <input type="submit" />
      <input type="text" />
      <select><option>Option</option></select>
    
      <textarea></textarea>
      <button>Button</button>
    </form>
    Code:
    // change value of the text input
    $(':text').val('change value');
    
    // find all change inputs
    $(':changed');
    // results only the previous modified text input