|
<< Click to Display Table of Contents >> Navigation: Forum > JavaScript Insertion Place |
03-15-2019, 02:13 AM:
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
03-15-2019, 02:49 PM:
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?
03-20-2019, 07:02 PM:
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!
Shane
03-20-2019, 10:12 PM:
Check this out.... We hope you will be as amazed as we are.
https://doc.atozed.com/en/iw17/lang/delp...roperties/
03-22-2019, 02:21 AM:
(03-20-2019, 10:12 PM)kudzu Wrote: [ -> ]Check this out.... We hope you will be as amazed as we are.
https://doc.atozed.com/en/iw17/lang/delp...roperties/
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 !
All the best,
Shane