We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Typescript button onclick event is not triggering

import {Button} from '@syncfusion/ej2-buttons';

class ProductExtraPopups {

private editBrandBtn: Button;

constructor() {

this.setupEditBrandPopup();
}


private setupEditBrandPopup() {
this.editBrandBtn = new Button({
isPrimary: true,
content: "Add New",
});

this.editBrandBtn.appendTo('#add-new-brand');

this.editBrandBtn.element.onclick = (): void => {
console.log('It is working !');
}
}
}

const extraPopups = new ProductExtraPopups();


html file


<button id="add-new-brand" type="button"></button>


https://ibb.co/3Tn9fHz

Console message is not showing in the browser console. Any suggestions would be grateful.



1 Reply

YA YuvanShankar Arunagiri Syncfusion Team October 10, 2022 12:50 AM

Hi Shanaka,


We unable to replicate the issue in our end. For your reference we prepared the sample.

Sample link: https://stackblitz.com/edit/csfnrl?file=index.ts

If you are still facing issue, please share the below details.


  • Share the issue reproducible sample or replicate the issue in our sample.

Please provide the above requested information, based on that we will check and provide you a better solution quickly.


Regards,

YuvanShankar A


Loader.
Live Chat Icon For mobile
Up arrow icon