I searched my site on this https://developers.google.com/speed/pagespeed/insights/ it showed I have Render blocking javascript (jquery).. so I put async
<script src="js/jquery-3.1.1.min.js" async></script>
after that I got the following error..
Uncaught ReferenceError: $ is not defined
for the following jquery dependent code
$(function(){
$('.SOMECLASS').on('click', function(){
//some action
})
})
So I changed to the following
document.addEventListener("DOMContentLoaded", function(event) {
$('.SOMECLASS').on('click', function(){
//some action
})
})
But still it is throwing the same error. also tried
window.onload = function(event) {
$('.SOMECLASS').on('click', function(){
//some action
})
}
but it if add window.onload click functions doesn't work..
How to make the code run after jquery is loaded?
Please help me..