Diferencia entre revisiones de «Calculators.js»
Ir a la navegación.
Sin resumen de edición |
Sin resumen de edición |
||
Línea 6: | Línea 6: | ||
//Calculator | //Calculator | ||
var newInput = "<input type='number' class='input_amount target' value='1' max='50000' min='' />"; | var newInput = "<input type='number' class='input_amount target' value='1' max='50000' min='' />"; | ||
($('# | ($('#input_amount')).html(newInput); | ||
var amountsArray = []; | var amountsArray = []; | ||
$('.item_number').each(function(index, element){ | $('.item_number').each(function(index, element){ |
Revisión del 02:22 29 ago 2023
ui = {
initPage: function () { console.log("Calculators Script loaded"); //Calculator var newInput = "<input type='number' class='input_amount target' value='1' max='50000' min= />"; ($('#input_amount')).html(newInput); var amountsArray = []; $('.item_number').each(function(index, element){ amountsArray[index] = parseInt($(element).text); }) if(isNaN($(".amount_input") && $(".amount_input").value > 0)){ var inputValue = $('.amount_input').value; $('.item_number').each(function(index, element){ $(element).text = amountsArray[index] * inputValue; }) }else{ $('.item_number').each(function(index, element){ $(element).text = amountsArray[index]; }) } }, init: function () { ui.initPage(); }
}
ui.init();