12345678910111213141516171819 |
- const userData = () => {
- const userName = document.getElementById('name').value;
- const userSurname = document.getElementById('surname').value;
- const userPhone = document.getElementById('phone').value;
- const userAddress = document.getElementById('address').value;
- if (userName && userPhone) {
- return {
- name: userName,
- surname: userSurname,
- phone: userPhone,
- address: userAddress
- }
- }
- }
- document.querySelector('.user-info').onsubmit = function (event) {
- event.preventDefault();
- localStorage.setItem('userInfo', JSON.stringify(userData()));
- window.open('./cart.html')
- }
|