Introduction:
Here I will explain how to get whole number division in JavaScript or jQuery using Math.ceil() method. Math.ceil() method will rounds number upwards to next nearest integer.
Description:
In previous articles I explained how to remove row in table using jQuery, jQuery highlight table row and column on mouseover in asp.net, jQuery detect caps lock on or not, jQuery change image on mouseover, jQuery dropdown with images, jQuery Countdown timer script example and many articles relating to jQuery and asp.net. Now I will explain how to get whole number division in JavaScript or jQuery using math.ceil() method.
In previous articles I explained how to remove row in table using jQuery, jQuery highlight table row and column on mouseover in asp.net, jQuery detect caps lock on or not, jQuery change image on mouseover, jQuery dropdown with images, jQuery Countdown timer script example and many articles relating to jQuery and asp.net. Now I will explain how to get whole number division in JavaScript or jQuery using math.ceil() method.
Declaration
of Math.ceil() method
Generally we will use Math.ceil() method
like as shown below
|
If
you want to check it in complete example we need to write the code like as
shown below
Sample1:
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Get Whole Number Division in Javascript</title>
<script type="text/javascript">
function Getdivision() {
var result = Math.ceil(25 / 4);
alert("Result:
" + result);
}
</script>
</head>
<body>
<form id="form1">
<div>
<input type="button" value="Click to Get Division Value" onclick="Getdivision()"
/>
</div>
</form>
</body>
</html>
|
Live
Demo
To
check live demo try to click on below button to check result of 25 division
with 4
If you enjoyed this post, please support the blog below. It's FREE! Get the latest Asp.net, C#.net, VB.NET, jQuery, Plugins & Code Snippets for FREE by subscribing to our Facebook, Twitter, RSS feed, or by email. |
|||
|
|||
1 comments :
:-)
Note: Only a member of this blog may post a comment.