How to dynamically change the format type of the NumericTextBox?

Hi,
I would need to dynamically change the format of the NumericTextBox; in particular I need to be able to go from a "c2" format to a "c6" format on the same object;
I tried this type of directive but it does not work:

var currency = document.getElementById ("currency"). ej2_instance [0];
currency.format = "c6";

Can you help me?
Thanks in advance for the time you dedicate to me.
Barbara Inzitari.

3 Replies

SK Shanmugaraja K Syncfusion Team August 13, 2018 07:12 AM UTC

Hi Inzitari, 
 
Thank you for using Syncfusion products. 
 
We have checked your provided code example, we suggest you to use ej2_instances[0] to get the instance of the NumericTextBox to resolve the problem. Please check the below code example and sample link, 
 
[JS
 
 
  function changeFormat() { 
      var currency = document.getElementById("currency").ej2_instances[0]; 
      currency.format = "c6"; 
  } 
 
 
 
Please try the above details and get back to us if you need further assistance. 
 
Regards, 
Shanmugaraja K 



NI nimue August 14, 2018 02:24 PM UTC

Hi Shanmugaraja,
sorry for the delay in replying, and thanks for your example, everything works perfectly now.
Barbara Inzitari


SN Sridhar N Syncfusion Team August 15, 2018 06:00 AM UTC

Hi Inzitari, 
We are happy to hear that your issue is resolved. Please get back to us if you need further assistance. 
Regards, 
Sridhar N  


Loader.
Up arrow icon