Search results

Display numeric keypad when focus on mobile devices in React MaskedTextBox component

18 Oct 2021 / 1 minute to read

By default, on focusing the MaskedTextBox, alphanumeric keypad will be displayed on mobile devices. Sometimes only numeric keypad for number values is needed, and this can be achieved by setting “type” property to tel. Refer to the following example to enable numeric keypad in MaskedTextBox.

Copied to clipboard
import { MaskedTextBoxComponent } from '@syncfusion/ej2-react-inputs';
import * as React from "react";
import * as ReactDOM from "react-dom";

export default class App extends React.Component<{}, {}> {
  public render() {
      return (
          <br/><MaskedTextBoxComponent name="mask_value" mask='999-99999' value= "342-45432" type="tel"/>
ReactDOM.render(<App />, document.getElementById('masktextbox'));
Copied to clipboard
<!DOCTYPE html>
<html lang="en">

    <title>EJ2 React MaskedTextBox</title>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta name="description" content="React MaskedTextBox Component" />
    <meta name="author" content="Syncfusion" />
    <link href="styles.css" rel="stylesheet" />
    <link href="//" rel="stylesheet" />
    <link href="//" rel="stylesheet" />
    <script src=""></script>
    <script src="systemjs.config.js"></script>

    <div class='wrap'>
        <form id="form-element" class="form-horizontal">
            <div class="form-group">
                <div id='masktextbox'>
                    <div id='loader'>Loading....</div>
                <div id="error" />