Categories

setDefault()

Categories: Utilities

setDefault( value )

Plugin: ep.core

Description: Set a new default value for inputs or selectboxes.

  • setDefault( value )

    version added: 6.15.1

    value   The new value for the element. (String for text input, textarea, select; boolean for checkbox, radio button).

The setDefault() method sets the new value and default value to the given element(s).

For checkboxes and radio buttons the checked attribute is set and also the property defaultChecked. For text inputs and textareas the value and default value will be changed. For select boxes the defaultValue of the default and new selected option is changed.
  • Set a new default value.

    HTML:
    <input type="radio" checked="checked" />
    
    Code:
    ep('input').setDefault(false);
    
    Results:
    The property defaultChecked of the radio button is now set from true to false.