// capture selling price change
$('#frmFilters').on('change', 'input[name="sell[]"]', function() {
// define the tr that we want to pull form values from
var row = $(this).closest('tr');
// set up values for form fields to pass through to ajax call
var sell = row.find('.sell').val();
var pkID = row.find('.lineup').val();
var sku = (row.find('.sku').map(function(){
return this.name + '=' + this.value;
}).get().join('&'));
// do ajax call
$.ajax({ ... });
})
From the above code I want to format the price entered into the text field name = sell[] which also has a class of sell to always have 2 decimal points
How can I achieve this please
you could use the javascript function
toFixed(2)so that it always has two decimalEDIT – fiddle here with multiple fields http://jsfiddle.net/LtR9N/2/