How to convert decimal number to round off figure using JQuery

If you want to display decimal number to fix digit number. I mean to say i have a decimal number like 123.123 and i want to display round of number then use Jquery round method.


 <%@ Page Language="C#" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
<script src="Scripts/jquery-1.10.2.js"></script>
<script>
$(function(){
$('#Button1').click(function(){
$('#result').html(Math.round($('#Text1').val()))
});
})
</script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    Enter Number: <input id="Text1" type="text" value="123.123" />
<input id="Button1" type="button" value="Round Off value" />
<br />
<label id="result" style="font-size:16px" />
    </div>
    </form>
</body>
</html>
When we click on the button , TextBox value will be converted into Round Off value using JQuery method.

How to convert decimal number to round off figure using JQuery How to convert decimal number to round off figure using JQuery Reviewed by Jacob Lefore on June 12, 2015 Rating: 5

No comments