We can perform the mask operation for input fields in kendo UI as shown in below code:
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="utf-8">
- <title>Untitled</title>
-
- <link rel="stylesheet" href="http://kendo.cdn.telerik.com/2015.3.1111/styles/kendo.common.min.css">
- <link rel="stylesheet" href="http://kendo.cdn.telerik.com/2015.3.1111/styles/kendo.rtl.min.css">
- <link rel="stylesheet" href="http://kendo.cdn.telerik.com/2015.3.1111/styles/kendo.default.min.css">
- <link rel="stylesheet" href="http://kendo.cdn.telerik.com/2015.3.1111/styles/kendo.mobile.all.min.css">
-
- <script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
- <script src="http://kendo.cdn.telerik.com/2015.3.1111/js/angular.min.js"></script>
- <script src="http://kendo.cdn.telerik.com/2015.3.1111/js/jszip.min.js"></script>
- <script src="http://kendo.cdn.telerik.com/2015.3.1111/js/kendo.all.min.js"></script></head>
- <body>
- <label for="phonenumber">Phone number:</label>
- <input id="phonenumber" value="9843755448" />
- <script>
- $(document).ready(function() {
- $("#phonenumber").kendoMaskedTextBox({
- mask: "(999) 000-0000"
- });
- })
- </script>
- </body>
- </html>
MVVM Pattern
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="utf-8">
- <title>Untitled</title>
-
- <link rel="stylesheet" href="http://kendo.cdn.telerik.com/2015.3.1111/styles/kendo.common.min.css">
- <link rel="stylesheet" href="http://kendo.cdn.telerik.com/2015.3.1111/styles/kendo.rtl.min.css">
- <link rel="stylesheet" href="http://kendo.cdn.telerik.com/2015.3.1111/styles/kendo.default.min.css">
- <link rel="stylesheet" href="http://kendo.cdn.telerik.com/2015.3.1111/styles/kendo.mobile.all.min.css">
-
- <script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
- <script src="http://kendo.cdn.telerik.com/2015.3.1111/js/angular.min.js"></script>
- <script src="http://kendo.cdn.telerik.com/2015.3.1111/js/jszip.min.js"></script>
- <script src="http://kendo.cdn.telerik.com/2015.3.1111/js/kendo.all.min.js"></script></head>
- <body>
- <div id="example">
- <h4>Enter a number</h4>
- <input data-role="maskedtextbox"
- data-mask="(999) 000-0000"
- data-bind="visible: isVisible,
- enabled: isEnabled,
- value: phoneNumber,
- events: { change: onChange }"
- style="width: 100%">
- </div>
- <script>
- var viewModel = kendo.observable({
- phoneNumber:"9739168676",
- isEnabled: true,
- isVisible: true,
-
- });
- kendo.bind($("#example"), viewModel);
- </script>
- </body>
- </html>