Hello,
I've been stuck for quite some time on jquery not working in my tapestry project, despite using tapestry-jquery. This is a new project so I want to go jquery only (no prototype preferably). Just a quick how-to-reproduce to eliminate a lot of questions:
1) use maven to generate a new, clean tapestry project (5.3.7)
2) add tapestry5-jquery to pom
5) run project, the script works fine. no console errors. so tapestry-jquery is working fine and has automatically included and imported jquery in the HTML source. (doubly verified by checking the statements in HTML source file)
4) remove the sample application's jquery-using components:
- in index.tml, remove the zone tags and actionlink that refers to the zone
- in index.java, remove the zone injectcomponent and onincrementFromAjax
- in layout.tml, remove <t:alerts>
- just for clarity, we KEEP the little jquery script that we added earlier.
5) run project. script does NOT work. Console shows "$ is not defined". No more jquery includes in HTML source.
A simple example, but the same is true for any external jquery libraries (prettyPhoto, etc) that I import and which don't work if I don't include at least one of tapestry-jquery's components.
I'm not entirely sure, but I take it that tapestry-jquery detects that none of its jquery components are being used and therefore doesn't bother including jquery as a whole?
In and of itself this is a fine optimization, but is there no way to switch it off so even if I don't use any of tapestry-jquery's components, it still includes jquery? I'd prefer not to include jquery manually because then later if I happen to use a zone after all tapestry-jquery will kick in and include jquery a second time (and probably a different version too).
Is there a clean solution to this?
Thanks guys!