This is a migrated thread and some comments may be shown as answers.

[Solved] Change decimal digits in jquery?

1 Answer 48 Views
NumericTextBox
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
bseels
Top achievements
Rank 1
bseels asked on 27 Jan 2012, 06:18 PM
I have a NumericTextBox that I need to change the decimal digits based on the value of a selection of a combobox.  How do I change the decimal digit value within jquery? 

For example, if the user selected "Decimal 1" from the combobox, I need the number of decimal digits to be 2.  If "Decimal 2" is selected, I need the number of decimal digits to be 5.

Is this possible to do in jquery?

1 Answer, 1 is accepted

Sort by
0
Georgi Krustev
Telerik team
answered on 31 Jan 2012, 09:59 AM
Hello Brooke,

 
Thank you for contacting us. Yes you can accomplish this task using JavaScript:

function setDecimals(digits) {
   var textbox = $("#NumericTextBox").data("tTextBox");
   
   //set the decimal digits
   textbox.digits = digits;
 
   //set value in order to re-format the number
   textbox.value(textbox.value());
}

Regards,
Georgi Krustev
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the Telerik Extensions for ASP.MET MVC, subscribe to their blog feed now
Tags
NumericTextBox
Asked by
bseels
Top achievements
Rank 1
Answers by
Georgi Krustev
Telerik team
Share this question
or