JavaScript UI Libraries & Blazor Components Suite – Smart UI › Forums › Buttons › Form button custom click event › Reply To: Form button custom click event
April 22, 2021 at 3:50 pm
#101730
yavordashew
Member
Hi david,
Unfortunately if you want to add a custom event handler to a button in Smart.Form there is another approach.
I want to give you an example on how to achieve this by having made a code snippet for you.
//In your JS file
const smartForm = document.querySelector('form')
let ctrlButton = smartForm.querySelector('smart-button[role="button"]')
ctrlButton.addEventListener('click', ()=>{
console.log('Your function')
})
Let me know if that works for you.
Please, do not hesitate to contact us if you have any additional questions.
Best regards,
Yavor Dashev
Smart UI Team
https://www.htmlelements.com/