Aspdotnet-Suresh

aspdotnet-suresh offers C#.net articles and tutorials,csharp dot net,asp.net articles and tutorials,VB.NET Articles,Gridview articles,code examples of asp.net 2.0 /3.5,AJAX,SQL Server Articles,examples of .net technologies

JavaScript Get Whole Number Division using Math.Ceil function

Dec 11, 2014
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.


Declaration of Math.ceil() method

Generally we will use Math.ceil() method like as shown below


var result = Math.ceil(25 / 4);
alert(result + ", " + div);
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.

subscribe by rss Subscribe by RSS subscribe by email Subscribe by Email

1 comments :

Anonymous said...

:-)

Give your Valuable Comments

Note: Only a member of this blog may post a comment.

© 2015 Aspdotnet-Suresh.com. All Rights Reserved.
The content is copyrighted to Suresh Dasari and may not be reproduced on other websites without permission from the owner.