Overview

Custom jQuery code in Nicepage Website Builder can be added under the Site Settings or Page Properties > HTML > Additional HEAD HTML field. But If you add jQuery script in the usual way as follows, you may encounter jQuery is not defined error message in the browser Console:

<script> 
    jQuery(function() {
    // your code here
    });
</script>

It happens because the jQuery library is loaded with a defer attribute. It specifies that the script is executed when the page has finished parsing. Therefore, the custom jQuery code should have the corresponsive wrapper, which makes your code run after the page is loaded.

<script>  
  window.onload = function() {
// your code here
}
</script>

or

<script>  
 window.addEventListener('load', function () {
// your code here
}
</script>

## Overview Custom jQuery code in Nicepage Website Builder can be added under the Site Settings or Page Properties > HTML > Additional HEAD HTML field. But If you add jQuery script in the usual way as follows, you may encounter jQuery is not defined error message in the browser Console: <script> jQuery(function() { // your code here }); </script> It happens because the jQuery library is loaded with a defer attribute. It specifies that the script is executed when the page has finished parsing. Therefore, the custom jQuery code should have the corresponsive wrapper, which makes your code run after the page is loaded. <script> window.onload = function() { // your code here } </script> or <script> window.addEventListener('load', function () { // your code here } </script> ##