We know such syntaxes as below, when defining a value for onClick attribute:
value
onClick
&
You can just bind a function as a data attribute
const ele = $('button'); ele.data('onClick', evt => { alert('bye'); }) ele.click(evt => { const ele = $(evt.target); ele.data('onClick')(evt); })