Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
JavaScript Insertion Place
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:

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({
  alert("Clicked in Box");
  } else{
  alert("Clicked outside Box");

Any idea what I am doing WRONG?


Your code may be running after the element you want is being loaded into the DOM.

Can you make a simple ready to run SA dpr?
Howdy Big K!

Sorry for the delay getting back - I have been all over the place with getting my new web module done.

I have found some excellent jquery components I have wrapped and then others that are to much work. I really prefer app development for mobile devices and Windows to messing with web browsers!

Any how, I got the aforementioned routine to work and even added a property in some of my components to create a global javascript variable so I could check them if necessary (i.e. the drop-down calendar I am using apparently doesn't show up a child of the region I was checking to see if I needed to close it)!

Well, enough rambling-on ..... I need to get cameras and motorcycle ready to head out to Big Bend tomorrow.

Have a great week!

Check this out.... We hope you will be as amazed as we are.
(03-20-2019, 10:12 PM)kudzu Wrote: Check this out.... We hope you will be as amazed as we are.

Howdy K from Fort Davis Tejas!

That new feature looks great! It would be great to have variables in Delphi/C Builder that are binded and available to Javascript!

Looking forward to IW 17 if I ever get my new web module done  Big Grin!

All the best,


Forum Jump:

Users browsing this thread: 1 Guest(s)