Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function solve() {
- const makeInput = document.getElementById('make');
- const modelInput = document.getElementById('model');
- const productionInput = document.getElementById('year');
- const fuelType = document.getElementById('fuel');
- const originPrice = document.getElementById('original-cost');
- const sellPrice = document.getElementById('selling-price');
- const ulCarsList = document.getElementById('cars-list');
- const profit = document.getElementById('profit');
- const publishBtn = document.getElementById('publish');
- const tbody = document.getElementById('table-body');
- publishBtn.addEventListener('click', onPublish)
- function onPublish(e) {
- e.preventDefault();
- let make = makeInput.value
- let model = modelInput.value
- let product = Number(productionInput.value)
- let fuel = fuelType.value
- let oPrice = Number(originPrice.value);
- let sPrice = Number(sellPrice.value)
- if (sPrice <= oPrice || !make || !model || !product || !fuel) return;
- let publish = onCreate(make, model, product, fuel, oPrice, sPrice)
- tbody.appendChild(publish)
- makeInput.value = "";
- modelInput.value = "";
- productionInput.value = "";
- fuelType.value = "";
- originPrice.value = "";
- sellPrice.value = "";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement