Bug Tracker

Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#11424 closed bug (invalid)

$('.class') vs jQuery('.class') one returns null, the second returns the correct element

Reported by: sm1215 Owned by:
Priority: low Milestone: None
Component: misc Version: 1.7.1
Keywords: Cc:
Blocked by: Blocking:


Summary explains it all, it was my understanding $ was a valid shortcut for jQuery, but this has had me stumped for some time. I only substituted jQuery in out of desperation. I am still fairly new to jQuery so if this is not the case, then please disregard this message. Here is my code:

<script> (function(){

Doesn't work var $des = $('.description'); var $des = jQuery('.description'); console.log($des);

})(); </script>

My description class is inside a div, nested in a list, so maybe that could have been causing some problems? It just seemed strange to me that one method works and the other doesn't. Anyways, as I've said, I'm still relatively new, so there may be something I have missed. Thought it was worth mentioning though.

Change History (2)

comment:1 Changed 11 years ago by timmywil

Component: unfiledmisc
Priority: undecidedlow
Resolution: invalid
Status: newclosed

You are either in noConflict mode or something has overwritten $. Please ask for support on the forums or in the #jquery irc channel.

comment:2 Changed 11 years ago by sm1215

Yes, I had lightbox also running, and after disabling it, it works fine. I had not considered that something was overwriting $. My apologies for any time wasted. I didn't even mean to post this yet, I was trying to preview it, and had trouble, it was marked as spam? I still wanted to read through the guidelines and I was trying to get it running in jsFiddle. Lol... ughh I am unfamiliar with the ticket system, thank you for your response.

Note: See TracTickets for help on using tickets.