After upgrading WordPress from 4.9.13 to 5.3.2 some scripts on website stop working in weird way... (example for clndr.js).
All scripts are added via wp_register_script
and wp_add_inline_script
WordPress' functions.
At bottom of <body>
there are three scripts as always:
<script type='text/javascript' src='http://example.com/clndr.min.js'></script>
<script type='text/javascript' src='http://example.com/calendar.js'></script>
<script type='text/javascript'>
var calendar = create_calendar();
</script>
Relevant part of calendar.js
function create_calendar()
{
var calendar = $('#Calendar').clndr({
// clndr options
});
return calendar;
}
All scripts should run in right order, but they are not working and in browser console I have this error:
TypeError: $(...).clndr is not a function
Also, changing call to create_calendar
in this way:
window.addEventListener("load", function(){
var calendar = create_calendar();
});
changes only order of errors in console.
If I understand everything correctly, this should just work.. Any ideas? Or hints how to debug this?
$
in WordPress. See wordpress.stackexchange.com/questions/2895/…