Hello, I’m trying to include JS file to my View but when I use registerJsFile with POS_READY
$this->registerJsFile('@web/js/daily.js' , ['position' => View::POS_READY]);
JS code is not working, file daily.js is not included anywhere in generated web page source code. It is the same situation when I included JS file in Asset bundle.
But when POS_READY is changed to POS_BEGIN, JS file is included in generated web page source code and it’s working.
For testing purposes I have used following JS file:
daily.js
jQuery(document).ready(function() {
$('#myButton').on('click', function() { alert('Button clicked!'); });
});
What I’m doing wrong ? Please, could someone explain how to properly use custom jQuery code in Yii? Thank you in advance