Round up values jQuery

Asked

Viewed 7,371 times

3

I got the following jQuery:

$(".quantidade_lotes").change(function() {
    var quantidade_linhas = $("#quantidade_linhas").val();
    var quantidade_lotes = $(".quantidade_lotes").val();
    var quantidade_dividida = (quantidade_linhas/quantidade_lotes);
});

In this, quantity_lines is = 17, quantity_lots = 5, and quantity_divided = 3.4. I need the result to be 4, always renting up. How can I do this?

1 answer

10


You can use Ceil function();

Math.ceil(1.4)

Returns 2;

Source

  • In fact, the right thing would be: Rent down and what’s left, I play in the last lot... I got to understand @dsantoro?

Browser other questions tagged

You are not signed in. Login or sign up in order to post.