Completed
Last Updated: 22 Jul 2021 10:11 by ADMIN
Imported User
Created on: 21 Apr 2014 13:05
Category: MaskedTextBox
Type: Feature Request
3
Method to modify mask in MaskedTextbox
Method to modify mask in MaskedTextbox
1 comment
ADMIN
Viktor Tachev
Posted on: 22 Jul 2021 10:11

Hi,

 

This functionality can be achieved via the setOptions method:

    <input id="phone_number"  />
    <button id="changeMaskBtn" class="k-button">Change mask</button>
    
    <script>
      $(document).ready(function() {
        $("#phone_number").kendoMaskedTextBox({
          mask: "(999) 000-0000"
        });

        $("#changeMaskBtn").on("click", function() {
          var maskedTextBox = $("#phone_number").getKendoMaskedTextBox();
          maskedTextBox.setOptions({
            mask: "0000 0000 0000 0000"
          });
        });

      });
    </script>

 

The approach is illustrated in the following example:

https://dojo.telerik.com/ovibELoJ/2


Regards,
Viktor Tachev
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.