Search code examples
jquerydivide

Divide To Ids to get a new result


I have 2 Ids #totalcbm and #gross, i want to divide both these values using jquery and to store the result in a new id #result.

How can i do this using jQuery.


Solution

  • var result = parseFloat(('#totalcbm').val()) / parseFloat(('#gross').val());
    $('#result').val(result);