Through the use of document.createElement("th")
, I am dynamically inserting columns into a table.
var newTH = document.createElement('th');
Is there a way to add an onClick
attribute to this element so that users can delete a column by clicking on its header? Any assistance would be greatly appreciated. Alternatively, if direct application of the event listener is not feasible, can something be placed within
newTH.innerHTML
to achieve the desired functionality?