# Same function for multiple buttons which uses the clicked button's properties

**URL:** <https://forum.wixstudio.com/t/same-function-for-multiple-buttons-which-uses-the-clicked-buttons-properties/21354>\
**Category:** Ask the community\
**Tags:** code, question\
**Created:** [September 2, 2019, 2:33pm UTC](https://forum.wixstudio.com/t/same-function-for-multiple-buttons-which-uses-the-clicked-buttons-properties/21354 "2019-09-02T14:33:00Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![iaindowner](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/iaindowner/32/7194_2.png) [@iaindowner](https://forum.wixstudio.com/u/iaindowner)\
**Post date:** [September 2, 2019, 2:33pm UTC](https://forum.wixstudio.com/t/same-function-for-multiple-buttons-which-uses-the-clicked-buttons-properties/21354/1 "2019-09-02T14:33:00Z")

</div>

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:

```javascript
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?
