Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
JavaScript Insertion Place
#1
Howdy All!

I have a region that is visible for the user to add some notes. If the user clicks outside the region, I want to close it. I have found the following code example:

https://jsfiddle.net/kym2rvyL/1/



I have tried adding a modified version of the function below to my form's Javascript property but it doesn't get called.

window.addEventListener('click', function(e){


if (document.getElementById('clickbox').contains(e.target)){
  alert("Clicked in Box");
  } else{
  alert("Clicked outside Box");
  }
})




Any idea what I am doing WRONG?

Thanks,

Shane
Reply


Messages In This Thread
JavaScript Insertion Place - by ShaneStump - 03-15-2019, 02:13 AM
RE: JavaScript Insertion Place - by kudzu - 03-15-2019, 02:49 PM
RE: JavaScript Insertion Place - by ShaneStump - 03-20-2019, 07:02 PM
RE: JavaScript Insertion Place - by kudzu - 03-20-2019, 10:12 PM
RE: JavaScript Insertion Place - by ShaneStump - 03-22-2019, 02:21 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)