Grails
  1. Grails
  2. GRAILS-7606

<g:javascript library="jquery"/> is not working

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Duplicate
    • Affects Version/s: None
    • Fix Version/s: 2.0 final
    • Component/s: None
    • Labels:
      None

      Description

      If you add <g:javascript library="jquery"/> to a GSP, the link to the JS file is wrong because it doesn't include the path to the plugin.

      To workaround this, use:

      <g:javascript library="jquery" plugin="jquery"/>
      

      I suspect this issue will hit the Prototype plugin as well.

        Issue Links

          Activity

          Hide
          Lukasz Dybcio added a comment -

          1.4.0M1 affected, the work-around in bug report does not work for me

          Show
          Lukasz Dybcio added a comment - 1.4.0M1 affected, the work-around in bug report does not work for me
          Hide
          Graeme Rocher added a comment -

          lowering priority since it works fine if you specify the plugin attribute or if you use the resources plugin with r:layoutResources

          Show
          Graeme Rocher added a comment - lowering priority since it works fine if you specify the plugin attribute or if you use the resources plugin with r:layoutResources
          Hide
          Lukasz Dybcio added a comment -

          Maybe I'm doing smth wrong but using

           <g:javascript library="jquery" plugin="jquery"/>

          doesn't work for me.

          However it works good with resources plugin when following steps desc. in grails resources plugin i.e. changing main.gsp and adding <r:layoutResources/>

           
          <!doctype html>
          <html>
          	<head>
                <meta name="layout" content="main"/>
                <r:require modules="jquery"/>
          		<title>Example</title>
          	</head>
          	<body>
          		<a href="http://jquery.com/">jQuery</a>		
          	   <jq:jquery>
          	       $("a").click(function(event){
          	         alert("As you can see, the link no longer took you to jquery.com");
          	         event.preventDefault();
          	       });
          	    </jq:jquery>
          	</body>
          </html>
          

          Could you please specify how the html file should look like when using plugin attribute work-around?

          Show
          Lukasz Dybcio added a comment - Maybe I'm doing smth wrong but using <g:javascript library= "jquery" plugin= "jquery" /> doesn't work for me. However it works good with resources plugin when following steps desc. in grails resources plugin i.e. changing main.gsp and adding <r:layoutResources/> <!doctype html> <html> <head> <meta name= "layout" content= "main" /> <r:require modules= "jquery" /> <title> Example </title> </head> <body> <a href= "http://jquery.com/" > jQuery </a> <jq:jquery> $( "a" ).click(function(event){ alert( "As you can see, the link no longer took you to jquery.com" ); event.preventDefault(); }); </jq:jquery> </body> </html> Could you please specify how the html file should look like when using plugin attribute work-around?
          Hide
          Noppanit Charassinvichai added a comment -

          I have the same problem.

          Show
          Noppanit Charassinvichai added a comment - I have the same problem.
          Hide
          Peter Ledbrook added a comment -

          Please see GRAILS-7801, which is a more specifically about the plugin attribute not working.

          Show
          Peter Ledbrook added a comment - Please see GRAILS-7801 , which is a more specifically about the plugin attribute not working.

            People

            • Assignee:
              Unassigned
              Reporter:
              Peter Ledbrook
            • Votes:
              1 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development