I want to use jquery in my moodle page.
I have try $PAGE->requires->jquery();
It showing me error
Can not add jQuery plugins after starting page output!Please check attached file. Line no 597
I want to use jquery in my moodle page.
I have try $PAGE->requires->jquery();
It showing me error
Can not add jQuery plugins after starting page output!Please check attached file. Line no 597
Please look into this, maybe I am going something wrong with JS.
I am using external jquery.min.js file and it's working fine. but when I am going to submit plugin code checker showing me lots the errors of coding standards. So I feel that and ideally I should use $PAGE->requires->jquery(); of Moodle jquery lib.
But it's showing me
Can not add jQuery plugins after starting page output!Please help me out.
You are calling :$PAGE->requires->jquery() too late.
You need to call that before you call $renderer->header() or $OUTPUT->header()
Depending on your plugin, you may not be in a situation to do that. In that case, you should try to write your javascript as AMD modules which will have jquery available to them.