[OpenLayers-Users] OpenLayers and JQuery

Amos Hayes ahayes at gcrc.carleton.ca
Thu Dec 4 15:44:44 EST 2008


That's odd Norman. I'm using the latest OpenLayers and JQuery together  
on the same page without issue and without doing anything special to  
avoid conflict. The basic features of OpenLayers that I'm using work  
fine, and I'm able to use the $() function as is. I am loading the  
Google and OpenLayers scrips before I load jQuery. I don't load  
prototype separately and I'm working with the single file version of  
OpenLayers.

I wonder if you are having global variable issues.

I've followed this guide to compartmentalize my code and isolate the  
things I create from the global namespace. Have a look at it and the  
article referenced by it.

http://yuiblog.com/blog/2007/06/12/module-pattern/

Might not be related, but seems to be good procedure. Hope that helps!

--
Amos Hayes
Geomatics and Cartographic Research Centre
Carleton University
ahayes at gcrc.carleton.ca
+1.613.520.2600x8179

On 4-Dec-08, at 1:29 PM, Norman Barker wrote:

> Hi,
>
> I would like to use OpenLayers and JQuery together.  I noted the
> jquery and prototype library conflicts and have added
>
> $j = jQuery.noConflict();
>
> to make the $ function available to OpenLayers.
>
> However on loading the page I get (with firebug)
>
> str.indexOf is not a function
> [Break on this error] return (str.indexOf(sub) != -1);
>
> which is defined in OpenLayers BaseType.
>
> Is there a workaround for the base types conflicts between OpenLayers
> and JQuery?
>
> Many thanks,
>
> Norman
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users




More information about the Users mailing list