Want to use jQuery in a static block or CMS page? No problem! Open the page or block in Magento 2 admin and insert the following code:
|
1 2 3 4 5 6 7 8 |
<script> require([ 'jquery' ,'domReady!' ], function ($) { console.log('whatever'); }); </script> |
If you do not want to wait for the domReady event, simply remove the corresponding line. The code then looks like this:
|
1 2 3 4 5 6 7 |
<script> require([ 'jquery' ], function ($) { console.log('whatever'); }); </script> |
Using jQuery with domReady in a CMS page or static block
Need help implementing this solution, or still looking for a fix to your Magento problem? Get in touch and I will be happy to help with your project.