# Text inputs

Home Search

## Text inputs

- Basics
- Options
- Methods
- Events

The text input plugin has the following options:

`clearBtn` boolean

  default: false

  Adds a clear button to the input (not available for textareas). This option is also exposed as a data attribute: `data-clear-btn="true"`

      $('.selector').textinput({ clearBtn: true });

`clearBtnText` string

  default: "clear text"

  The text description for the optional clear button, useful for assistive technologies like screen readers. This option is also exposed as a data attribute: `data-clear-btn-text="Clear input"`

      $('.selector').textinput({ clearBtnText: "Clear value" });

`disabled` boolean

  default: false

  Sets the default state of the text input to disabled when "true".

      $('.selector').textinput({ disabled: true });

`initSelector` CSS selector string

  default: "input[type='text'], input[type='search'], :jqmData(type='search'), input[type='number'], :jqmData(type='number'), input[type='password'], input[type='email'], input[type='url'], input[type='tel'], textarea, input[type='file'], input:not([type])"

  This is used to define the selectors (element types, data roles, etc.) that will automatically be initialized as textinputs. To change which elements are initialized, bind this option to the mobileinit event:

      $( document ).on( "mobileinit", function(){
         $.mobile.textinput.prototype.options.initSelector = ".myInputs";
      });

`mini` boolean

  default: false

  Sets the size of the element to a more compact, mini version. This option is also exposed as a data attribute: `data-mini="true"`

      $('.selector').textinput({ mini: true });

`preventFocusZoom` boolean

  default: true on iOS platforms

  This option disables page zoom temporarily when a custom input is focused, which prevents iOS devices from zooming the page into the input. By default, iOS often zooms into form controls, and the behavior is often unnecessary and intrusive in mobile-optimized layouts. This option is also exposed as a data attribute: `data-prevent-focus-zoom="true"`

      $('input').textinput({ preventFocusZoom: true });

`theme` string

  default: null, inherited from parent

  Sets the color scheme (swatch) for all instances of this widget. It accepts a single letter from a-z that maps to one of the swatches included in your theme. By default, it will inherit the same swatch color as its parent container if not explicitly set. This option is also exposed as a data attribute: `data-theme="a"`

      $('.selector').textinput({ theme: "a" });

### More in this section

- Form elements
- Form basics
- Form element gallery
- Mini form element gallery
- Text inputs
- Search input
- Slider
- Flip toggle switch
- Radio buttons
- Checkboxes
- Select menus
- Theming forms
- Native form elements
- Submitting forms