I have been struggling to open a dialog box through two different buttons but maybe because of same ID it is showing dialog box through first button only. Could you please help me to make the other button functional properly so I can open the dialog box through both buttons.
Here is fiddle.
http://jsfiddle.net/awaises/rsr9ojyL/1/
Code:
(function() {
var dlgtrigger = document.querySelector( '[data-dialog]' ),
somedialog = document.getElementById( dlgtrigger.getAttribute( 'data-dialog' ) ),
dlg = new DialogFx( somedialog );
dlgtrigger.addEventListener( 'click', dlg.toggle.bind(dlg) );
})();
The problem is that the document.querySelector('[data-dialog]');
returns only the first element found. I have added jQuery which properly finds both of them and your dialog is opened by clicking on any of the buttons. See the fiddler.