Jquery javascript issue in action page

When I am putting any jQuery/JavaScript code in to the custom module action page then it’s not identifying the jQuery tag as because it’s not including JavaScript library. But as far I know in Dolibarr we don’t need to include JavaScript library file every where. Even when I am including it using CDN then the design is getting changed in whole system.

I am putting this

print ‘’;

Capture

and error I am getting this

use jQuery instead of $. This is a jQuery requirement, that has nothing to do with Dolibarr.

1 Like

Hi @milenmk

Thanks for your reply. I have used jQuery instead $ but my question if I will have to use jQuery under doActions hook then what should I do? Because without including jQuery library under this hook jQuery is not working in the action file.

jQuery (jquery.min.js) is included by default in the header for all Dolibarr pages. If it’s not working for your action file, you can use <script src="/htdocs/includes/jquery/js/jquery.min.js"></script> to include it.

Hi @milenmk

Thanks for your reply. Will try this.

Regards
Saikat

I have used this
print ‘’.“\n”;
But then whole Dolibarr’s text font is getting changed and looks like it’s clashing with some other java script.

hello, if you want jquery to be instantiated, you should put your script at the end of the page.
in your doActions hook, just do something like this :

$conf->global->MAIN_HTML_FOOTER .= '<script type="text/javascript"> $(document).ready(function() { alert("test"); });</script>';

Hi @altatof

Thanks for your reply. I will test that and let you know.

Regards
Saikat