I hope this isn't a double post... This is kind of an awkward problem to
search on

Perhaps the root of my problem is the custom function I've written, but I've
set up an "increase/decrease text size" function on a site and it's not
working in ie6 (works fine on XP in ff2, ie7, Opera9, and Safari3)

IE6 or FF does not report an error unless I change .click() to .hover()
in which case, the errors are:
IE6: 'g' is null or not an object
FF2/fireBug: g has no properties
(I'm using jquery 1.2.1 packed)

Here's the code:
JS:

$(document).ready(function() {
        $('div#utility p.resize span.increase').click(function() {
                if($('div#wrap').attr('class') == "default") {
                        $('div#wrap').removeClass("default");
                        $('div#wrap').addClass("medium");
                        }
                else if($('div#wrap').attr('class') == "medium") {
                        $('div#wrap').removeClass("medium");
                        $('div#wrap').addClass("large");
                        }
                else if($('div#wrap').attr('class') == "large") {
                        $('div#wrap').removeClass("large");
                        $('div#wrap').addClass("xlarge");
                        }
        });
});

$(document).ready(function() {
        $('div#utility p.resize span.decrease').click(function() {
                if($('div#wrap').attr('class') == "xlarge") {
                        $('div#wrap').removeClass("xlarge");
                        $('div#wrap').addClass("large");
                        }
                else if($('div#wrap').attr('class') == "large") {
                        $('div#wrap').removeClass("large");
                        $('div#wrap').addClass("medium");
                        }
                else if($('div#wrap').attr('class') == "medium") {
                        $('div#wrap').removeClass("medium");
                        $('div#wrap').addClass("default");
                        }
        });
});


HTML:
<div id="wrap" class="default">
<div id="header">
        <div id="banner">
                <div id="utility">
                        <p class="breadcrumb">You are on the Start 
Page</p>
                        <p class="contrast" title="Hight Contrast 
Version">High Contrast
Version</p>
                        <p class="resize">Increase or decrease the text 
size: <span
class="increase" title="Increase text size">+</span> <span
class="decrease" title="Decrease text size">-</span></p>
                </div>


...The JS just changes the class on #wrap, and then the css takes care of
the text resizing

I'm not too hot at JavaScript, and I don't know jQuery front to back, so I'm
sure I'm probably doing something wrong...

any help is appreciated - and let me know if I need to post more code...
Thanks!
-- 
View this message in context: 
http://www.nabble.com/.click%28%29-not-working-in-ie6...-%27g%27-is-null-or-not-an-object-tf4488718s15494.html#a12801113
Sent from the JQuery mailing list archive at Nabble.com.

Reply via email to