Or return new JsQuery().$(".check-login").chain("attr", "'href'", "'#'");
Julien Roche On Mon, Oct 18, 2010 at 5:53 PM, julien roche AKA indiana_jules < roche....@gmail.com> wrote: > Hi Peter, > > The "right" way for your case will be: > > add(new WiqueryAbstractBehavior() { > public JsStatement statement() { > return new JsStatement ().$(null, ".check-login").chain("attr", > "'href'", "'#'"); > } > }); > > In the standard process, we will never have an empty component when the > renderHead method is called. Maybe we will renforce the code to enable your > approach. > > Regards > > Julien Roche > > > > On Mon, Oct 18, 2010 at 5:39 PM, Jeremy Thomerson < > jer...@wickettraining.com> wrote: > >> On Mon, Oct 18, 2010 at 10:02 AM, Peter Munro <spelud...@gmail.com> >> wrote: >> >> > Hi, >> > >> > I'd like to set up a JQuery script in my page header to change the >> > attributes of all links with a specified class, so in my Java code I >> tried >> > this: >> > >> > JsQuery linkQuery = new JsQuery(); >> > linkQuery.$(".check-login").chain("attr", "'href'", "'#'"); >> > add(new HeaderContributor(linkQuery)); >> > >> > I'm not sure if this code should do what I want yet, but in any case I >> get >> > a >> > NullPointerException (I'm using wiQuery 1.0.2): >> > >> > java.lang.NullPointerException >> > at >> > org.odlabs.wiquery.core.javascript.JsQuery.renderHead(JsQuery.java:133) >> > >> > >> > I looked at the JsQuery.java and it looks like renderHead() assumes >> > 'component' is initialised, but I'm using the no-arg constructor. >> > >> > Am I going about this the wrong way (and if so, what's the right way?!) >> or >> > is this a bug? >> > >> > Many thanks, >> > Peter >> > >> >> >> Have you tried emailing the wiquery users' list? I believe it's >> wiqu...@googlegroups.com >> -- >> Jeremy Thomerson >> http://www.wickettraining.com >> > >