Welcome to WebmasterWorld Guest from

Forum Moderators: open

Message Too Old, No Replies

grabbing CSS on a jQuery object



1:29 pm on Mar 25, 2013 (gmt 0)

10+ Year Member

I have the following function in which I'm trying to get CSS specs for various elements. One works and the other doesn't, and I don't know why.

function click(el) {
var chld = $(el).children().eq(1), dsply1 = $(chld).css("display"), dsply2 = ("#genID").css("display");

I get the value for dsply1 but not dsply2. Instead I get this error:

Object does not support property or method 'css'


2:16 pm on Mar 25, 2013 (gmt 0)

WebmasterWorld Senior Member fotiman is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

You're missing the $ before ("#genID")


3:09 pm on Mar 25, 2013 (gmt 0)

10+ Year Member

Oy - pls excuse me while I crawl under a rock.

If only jQuery would give errors like "Hey dummy, you forgot the '$'", I wouldn't have to bug you guys so much.

Featured Threads

Hot Threads This Week

Hot Threads This Month