JavaScript UI Libraries & Blazor Components Suite – Smart UI Forums General Discussions smart form controlType button add event handler

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #104332
    jqwidgetsdev
    Participant

    Hi,

    In a smart form, when I add controlType: “button” what is the way to assign a custom event handler?

                    {
                        controlType: "button",
                        label: <code>Run</code>,
                    },
    

    I thought this would do it, perhaps controlType: button needs to be treated differently?

        const smartButton = document.querySelector('smart-button');
    
        smartButton.addEventListener('click ', function (event) {
            console.log('hello world');
        });
    

    Any clues?

    #104333

    Hi,

    You have done it correctly but have a space in the event name – ‘click ‘.
    It should be only ‘click’. Try it and the problem must be fixed

    Best Regards,
    Svetoslav Borislavov

    Smart UI Team
    https://www.htmlelements.com/

    #104336
    jqwidgetsdev
    Participant

    Hi Svetoslav,

    Ok yeah sorry for bothering you about something so small.

    Thanks.

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.