Welcome to WebmasterWorld Guest from 54.167.83.224

Forum Moderators: open

Message Too Old, No Replies

grabbing CSS on a jQuery object

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

Preferred Member

10+ Year Member

joined:Nov 10, 2005
posts:387
votes: 0


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)

Senior Member from US 

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

joined:Oct 17, 2005
posts:4966
votes: 10


You're missing the $ before ("#genID")
3:09 pm on Mar 25, 2013 (gmt 0)

Preferred Member

10+ Year Member

joined:Nov 10, 2005
posts:387
votes: 0


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.