Skip to content Skip to sidebar Skip to footer

How To Masked An Input Text Box Which Is Data-bound To Knockout Computed Variable

I am using jquery MASKED INPUT PLUGIN for masking my input boxes which are data-binded to knockout variables. I have problem in masking if the knockout variable is Computed Variabl

Solution 1:

one way would be using trigger to add .mask when ever new element is created

Code:

$("#cool").on("click", function () {
   $(".one").mask("9999"); //dynamic elements with same class name get's mask
});
 $("#cool").trigger("click");

working sample with your code here

other simple way would be under your ko click event add .mask on class name make sure you maintain same class across mask-able elements like here

Post a Comment for "How To Masked An Input Text Box Which Is Data-bound To Knockout Computed Variable"