I'm having trouble attaching an event listener to a button that I have created inside a drawflow node. For my use case, I need to show a subset of object data in each node and then show the full object data onclick of the "Show All Info" button. However, when trying to retrieve the button element like so var showAllInfoBtn = document.getElementById('showAllInfoBtn); the variable showAllInfoBtn is always null.
var showAllEventInfoButton = document.getElementById('showAllInfoBtn');
console.log("showAllEventInfoButton: " + showAllEventInfoButton); // debug
showAllEventInfoButton.addEventListener('click', function () {
var index = parseInt(this.dataset.index);
showAllEventInfo(index);
});
By inspecting element I've confirmed that the html in the html variable is being added to the DOM. So, I'm not sure why showAllEventInfoButton is always null. Is there another, more standard way, of adding buttons and attaching event listeners to them inside drawflow nodes?
Apologizes if this is more of a js question than a drawflow question but my intuition says that there must be a more standard way to add buttons to drawflow nodes that I am just not aware of.
Thank you for your time and for creating such an awesome project!
I'm having trouble attaching an event listener to a button that I have created inside a drawflow node. For my use case, I need to show a subset of object data in each node and then show the full object data onclick of the "Show All Info" button. However, when trying to retrieve the button element like so
var showAllInfoBtn = document.getElementById('showAllInfoBtn);
the variableshowAllInfoBtn
is always null.I'm creating my nodes like so:
And attaching my event listener:
By inspecting element I've confirmed that the html in the
html
variable is being added to the DOM. So, I'm not sure whyshowAllEventInfoButton
is always null. Is there another, more standard way, of adding buttons and attaching event listeners to them inside drawflow nodes?Apologizes if this is more of a js question than a drawflow question but my intuition says that there must be a more standard way to add buttons to drawflow nodes that I am just not aware of.
Thank you for your time and for creating such an awesome project!