How to load a UI Script after the entire dom is ready
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā09-24-2018 10:00 AM
I have a UI script that I have made available to an application portal. The issue that I'm facing currently is that the UI script code is being loaded before the entire dom is ready. As a result, any reference to a dom element in the script would give me the following,
How can I load the code in the UI Script after the entire dom is ready?
Any help with this is greatly appreciated!
Thanks,
Raskill
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā09-24-2018 10:07 AM
var $j = jQuery.noConflict(true);
$j(document).ready(function () {
//Add your code here
});
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā09-24-2018 10:18 AM
I tried using jQuery and it did not work. It does not even load my portal page infact.
Thanks,
Raskill
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā09-24-2018 10:37 AM
Try addLoadEvent() its an OOB ServiceNow API
addLoadEvent(loadMe);
function loadMe(){
//Add your Code Here
}
Hope that helps!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā09-24-2018 10:49 AM
Hi Aman,
This did not work either š I see that my sample.jsdbx file is already loaded before the catalog form loads in the portal. Any other alternate approach?
Thanks,
Raskill