I basically have a div set up with an onClick action like so:
myDiv.setAttribute("onclick", myAction);
And later on, I place an image inside the div like this:
myDiv.innerHTML = '<img src="' + myImage + '" height="' + myDiv.height + '" width="' + myDiv.width + '">';
.width and . height are properties I have created for myDiv.
So my problem is that when I place the image inside the div, myDiv's onClick is not responding, is there anyway to solve this. I know of the div property backgroundImage, but that one does not support customizing of size in all browsers. I tried to give the image the same onClick action that the div has but that just got messy, is there any way to make javascript ignore the image and register a click in the div even though the click is in the image inside the div?
Visual explanation of the problem:
Thank you.