Question

I am currently working on a web app using Wicket and started using jQuery core (UI also) in it today. I ran into an issue I troubleshooted as a jQuery function (show(), slideDown()) colliding with some of the javascript Wicket auto-generated for an external form link.

Before I get deeper into this project I am wondering if anyone has had similar experiences. Are there a lot of places where the jQuery effects/actions collide with Wicket generated javascript/HTML? Are there clean ways to avoid this, or mitigate it?

I have seen Wicketext as possibly a cleaner "integrator" of the two, but mostly it seems to just be a way of doing more of the jQuery-ish code in the Java instead of JS.

Was it helpful?

Solution

This is an interesting problem since jQuery occupies it's own namespace. I'm guessing that there is a conflict with the $ jQuery variable. To get around this you can have jQuery occupy a different namespace like so:

var $j = jQuery.noConflict();

You can do this after you've loaded both sets of code and the $ will be returned to its original value. A bit of a headache but it can fix things in a pinch. See using jQuery with other libraries for more info.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top