xxxxxxxxxx
//addeventlistener click another button javascript
const myButton = document.getElementById('myButton');
const anotherButton = document.getElementById('anotherButton');
myButton.addEventListener('click', () => {
// Programmatically trigger click event on 'anotherButton'
const clickEvent = new MouseEvent('click', {
view: window,
bubbles: true,
cancelable: true
});
anotherButton.dispatchEvent(clickEvent);
});