I am trying to make a memory game using JavaScript and jQuery and now I want to disable clicking the image (card) that is opened on click. I have tried img.onclick=false, img.onclick=null, but it does not work. Below is a part of my code.
$(document).ready(function() {
$("img").click(function() {
checkIfMatch(this);
});
});
function checkIfMatch(img) {
arrayIMG.push(img);
img.onclick = false; //here I want to disable the clicking
}