Search.../

inputType

Sets or gets the input type of an Input element. Does not change the type of data stored in the text input's value property, which will remain a string.

Description

Setting the inputType property sets what type of data a user can enter into the text input element. However, it does not limit your ability to change the value programmatically.

Regardless of the type of data entered, the data will be stored as a string in the text input's value property. For example, if the user enters the number 42, the text input's value will hold the string "42". Any required type conversions will need to be implemented manually in page code.

Getting the inputType property gets what type of data a user can enter into the text input element.

The text input types are:

  • "text": Can contain any type of character.
  • "password": A password field. Text is hidden with bullets (•••).
  • "number": A valid number.
  • "email": A valid email address.
  • "url": A valid web address.
  • "tel": Can contain only digits and certain symbols.

You can also set an element's inputType property in the Editor using the Settings pane: Input Settings pane

Type:

stringRead & Write

Was this helpful?

Gets a text input's input type

Copy Code
1let type = $w("#myTextInput").inputType; // "email"
Sets a text input's input type

Copy Code
1$w("#myTextInput").inputType = "email";