Js snippet jQuery script is not executing when the page loads

9
I added a js snippet to a page (responsive web) that contains a jQuery script, for some reason, the script is not executing, I tried several methods to fix the problem but nothing seems to work, could anyone give me any suggestion.
asked
3 answers
2

You should add timeout functionality to make sure that your snippet will execute its content after the page/component loads 

 

For example: 

 

setTimeout(

function(){

// ADD YOUR CODE HERE

  },

1000);

 

This code will execute after a second, this will give the page some time to load before your script works.

answered
3

Try these, one of them should do the trick:

$(function() {
    console.log( "ready!" );
});

or

$( document ).ready(function() {
    console.log( "ready!" );
});

 

answered
1

Hi,

Kindly check the Mendix Console and Browser console, if there are any errors for the JQuery which has been added to the JS Snippet

answered