I would like to write a single function which can identify the text of the clicked button and then assign that function to multiple buttons. This will avoid writing the same function and amending for each button:
let toSave = {
"_id" : sessionid,
"postcode" : sessionpostcode,
"addressline1" : $w("#dropdown1").value,
"type" : clicked button text
};
wixData.save("mydataset", toSave)
.then( (results) => {
console.log("Type");
} )
.catch( (err) => {
let errorMsg = err;
} );
Can this be achieved?