Hello all,

I'm running into a problem where it looks like the toggle() method's
anonymous functions don't like object values in the css() method.

I'm not having any problems without this outside my toggle(), I'm
doing stuff like:

zip.css({
     'border': + zip_data.no_error.border,
     'background': + zip_data.no_error.background
});

And it works fine.  It's only inside toggle() that it gives me
problems.  Anyone know how I can resolve this?  I'm using the values
in my "zip_data" object several times so I'm trying to keep the actual
data in one place so that it's easily changed.  Also, I have several
other objects with data inside "zip_data", I didn't include those here
just to keep the code to a minimum.

Here's the pertinent code that is giving me trouble, anyone have any
ideas?

*********************************************************************************************************

var zip_data = {
     no_error: {
          border:'1px solid #e1e1e1',
          background:'#f2f3f2'
     }
};

$('form#zipcode').submit(function() {
        //bunch of stuff here
        //calling zip_data.no_error.border works fine

        $('#change_location').toggle(
                function() { //listener odd
                        //body
                },
                function() {//listener even
                        //body

                        //calling zip_data.no_error.border does NOT work here
                        //though I can console.log the object and see
the values just fine
                        //I have to hard code the object values below
for them to take
                        zip.css({
                                'border': '1px solid #e1e1e1',
                                'background': '#f2f3f2'
                        });
                }
        );
}

Reply via email to