jquery remove previous onclick code example
Example 1: remove add event listener jquery
//Remove all event handlers from all paragraphs:
$( "p" ).off();
//Remove all delegated click handlers from all paragraphs:
$( "p" ).off( "click", "**" );
Example 2: remove a function added to eventhandler
element.removeEventListener(type, handler);