addloadevent is not working

amaradiswamy
Kilo Sage

Hi All,

I want to display some alert message to user, when they are about to take survey from survey masters.

for that i need to call a client side script in "survey_take" UI page while it is loading.

So i have added below

addLoadEvent( function() {

onLoadFunction();

});

function onLoadFunction()

{

alert("hi");
//document.getElementById("myP").style.visibility = "hidden";

}

but it is not working and if i do inspect element then in that it is commenting the code?

find_real_file.png

Please help me to solve this issue.

4 REPLIES 4

Gurpreet07
Mega Sage

Add your code in client script section of ui page and don't use script tag.


I placed the function in scruipt tag and called it from body


like


<body onLoad="functionname()"> and it worked


but it is


actually my requirement is to hide some data placed on the UI page, that's why i want to make the client script works after the form loads but it is not hiding elements



Please help me on this



Thanks and regards


Swamy


Gurpreet07
Mega Sage

Please refer below screenshot


find_real_file.png


Ankur Bawiskar
Tera Patron
Tera Patron

Hi Swamy,



Which version you are using?


Is it working fine?



Regards


Ankur


Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader