Create Javascript alert when the page has fully loaded using: $(document).ready(function() {

  • 2
  • Question
  • Updated 4 years ago
How can I create a javascript alert from an inline snippet when a Skuid page has fully loaded, something like the below:

(function(skuid){

var $ = skuid.$;

$(document).ready(function() {

        $(function(){          

                alert(‘test’);     

});

})(skuid);

Photo of Eddie

Eddie

  • 720 Points 500 badge 2x thumb

Posted 4 years ago

  • 2
Photo of Moshe Karmel

Moshe Karmel, Champion

  • 8,646 Points 5k badge 2x thumb
Create a snippet of type "Inline", it defaults to the correct setup for running a page load snippet.
Photo of Eddie

Eddie

  • 720 Points 500 badge 2x thumb
Hi Moshe I created a snippet of type inline and have this:

var params = arguments[0],
    $ = skuid.$;
   
    alert('test');

and when I load the page, the javascript alert doesn't show, any thoughts
Photo of Pablo Martinez

Pablo Martinez

  • 2,468 Points 2k badge 2x thumb
you have to choose the "inline" option (not "inline (snippet)")

and:

(function(skuid){	
     var $ = skuid.$;
$(function(){
   alert('test');
});
})(skuid);
(Edited)
Photo of Eddie

Eddie

  • 720 Points 500 badge 2x thumb
Thanks Moshe that worked a treat