jQuery in smarty template

Hello,

I’ve spent a couple of hours trying to run some jQuery in a smarty template.

I’m using OJS 2.4.8.

I cannot get it to work. I’ve tried using {literal} tags around my <script> tag within the template. I’ve tried calling the jQuery code from a script tag within my template. I can get something like alert(‘Hi!’) to work, but any jQuery seems to throw an error like:

Unexpected string

or has no effect whatsoever (tried things like addClass or hide()).

Sample code:

{literal}
<script type="text/javascript">
$( document ).ready({
                    $("#myDiv").addClass("test");
                });
</script>
{/literal}

Can you please help me?

Thanks,
Gary

Try following an example like this: https://github.com/pkp/ojs/blob/master/templates/controllers/grid/issueGalleys/form/issueGalleyForm.tpl#L10-L25

Notice {ldelim} and {rdelim}

Antti-Jussi you are a genius!

Thanks again!