document.addEventListener("DOMContentLoaded", function(){
// Code here waits to run until the DOM is loaded.
let fn = document.querySelector("#field_psay1");
let ln = document.querySelector("#field_erko0");
let em = document.querySelector("#field_yykz1");
let ph = document.querySelector("#field_9syjg");
let lead = {firstname:"", lastname:"", phone:"", email:""};
fn.addEventListener('change',(e)=>{
lead.firstname = e.target.value;
localStorage.setItem('lead',JSON.stringify(lead));
});
em.addEventListener('change',(e)=>{
lead.email = e.target.value;
localStorage.setItem('lead',JSON.stringify(lead));
});
ln.addEventListener('change',(e)=>{
lead.lastname = e.target.value;
localStorage.setItem('lead',JSON.stringify(lead));
});
ph.addEventListener('change',(e)=>{
lead.phone = e.target.value;
localStorage.setItem('lead',JSON.stringify(lead));
});
});