JSFiddle - React, Tailwind, and code Playground

HTML

<img src="http://icons.iconarchive.com/icons/yellowicon/game-stars/256/Mario-icon.png" id="foo" onclick="alert('foo')" />
<input type ="button" id="bar" value="remove" >

CSS

#foo {height:150px;}

JavaScript

function disableimage(){ 
    alert('bar')
    return false;}
document.getElementById('foo').addEventListener('click',disableimage);

document.getElementById('bar').addEventListener('click', function(){ document.getElementById('foo').removeEventListener('click',disableimage);})