When i was working on core php project and i need to work with float value. Like i require to fixed decimal point with two digit after point. So i did search on google and found the tofixed() of javascript. But when i try and checked on my fire but, it say tofixed() is not a function. I thought what was wrong and i did try many way.
However, Finally i got what is issue and found the best solution. But i did simply use like as bellow example:
var myVal = $(".myfloat").val();
myVal = myVal.tofixed(2);
But above code was not working because i require to use "parseFloat" before use tofixed(), So i did simply use as bellow code:
Solution:
var myVal = $(".myfloat").val();
myVal = parseFloat(myVal).tofixed(2);
I hope you found your solution....
Do you like below Tutorials ?
- Angular 9 HttpClient Request with RxJS Observable Example
- How to Create Routing Module in Angular 9?
- How to Create Custom Directive in Angular 9?
- Print Iframe Content using JQuery Example
- Allow Only Numeric Values in Textbox using JQuery
- Codeigniter Confirmation Box Before Delete Item Example
- How to Use Sweet Alert in Codeigniter?
- Disable F5 Key And Browser Refresh Using Javascript