Showing posts with label jQuery. Show all posts
Showing posts with label jQuery. Show all posts

Friday, August 24, 2007

Conflicts between jQuery and Prototype objects in IE

I'm not sure that I have this problem correctly diagnosed, but I've been noticing a lot of errors in IE when I have lines of code that combine jQuery objects with Prototype functions. I guess this means that I've been sloppy with my JS and Firefox has been letting me get away with it! Here's an example of code that works in Firefox, but not IE:

var block = jQuery(".widgetBody", $(elementid))[0];
var blockstatus = block.getStyle('display');

It seems like the problem is mixing the jQuery object, block, with the prototype function, getStyle(). The error is removed when I replace the second line with a call to a jQuery function instead:

var blockstatus = jQuery(block).css("display");

I guess it makes sense that combining jQuery and Prototype code is a bad idea. I was using Prototype to begin with then started using more and more jQuery, and never went back to clean out all the Prototype. Heck there's even Prototype in the line with the jQuery search! Anyways...laziness is costing me now.

Monday, August 6, 2007

jQuery!

So I've been trying to update all of the pie wedge colors in real time as the color picker runs. To do so I have to have a quick and efficient way of grabbing, traversing, and setting specific DOM elements. jQuery, this fabulous javascript library does all that and more! It's super fast. But the documentation is a little harder to understand than for prototype.