Sunday, June 10, 2018

Jquery - Format number to 2 decimal places

Here is the below example for the discount calculation and get the value with 2 decimals.

$("#discount").change(function() {
    var list = $("#list").val();
    var discount = $("#discount").val();
    var price = $("#price");
    var temp = discount * list;
    var temp1 = list - temp;
    var total = temp1.toFixed(2);

    price.val(total);
});

Wednesday, April 25, 2018

Google map auto complete input text based on country

Here is the below example to enter the text in the input to get the Google geo locations automatically.