Remove and replace another onclick function in a div through Pure Javascript?
问题 I have this below span div and I copy this to another place in the DOM. But the onclick function I need to remove and place another onclick function. <span class="plus childNode1" onclick="expand_collapseChildnodes('childNode1')" id="abc"></span> Here I have to remove the onclick="expand_collapseChildnodes('childNode1')" for the copied element and replace it with onclick="checkNodes('childNode1')" 回答1: Consider a sample HTML page: <html> <head> </head> <body> <div id ="d1"> <span class="plus