Home >Web Front-end >JS Tutorial >How to round jquery value
Jquery value rounding method: 1. Rounding up is achieved through the "Math.ceil(a);" method; 2. Rounding down is achieved through the "Math.floor(a)" method; 3. Use the "Math.round(7/2);" method to achieve rounding.
The operating environment of this tutorial: windows10 system, jquery2.2.4, this article is applicable to all brands of computers.
Recommended: "javascript basic tutorial"
JQ rounding up and rounding down
Rounding up
var a = 23.2325236 var abc = Math.ceil(a); //注意:Math.ceil(a)不要单独写一行,否则向上取整失败 abc = 24;
Round down
var a = 23.2325236 var abc = Math.floor(a)//注意: Math.floor(a) 不要单独写一行,否则向下取整失败 abc = 23;
Round up
Math.round(7/2);
The above is the detailed content of How to round jquery value. For more information, please follow other related articles on the PHP Chinese website!