I'm new to jQuery and I can get it to sometimes work, however, for some reason, when I try to call a function, it gives me the title error, but if I do it in developer tools, it works fine.
http://jsfiddle.net/otanan/pmzzLo3e/#&togetherjs=AezijhfBrj
It seems to work fine when retrieving the classes from the DOM, but not when I call a function such as
.click(function() {});
Here's the code:
var downloads = $(".info"),
className = "info_clicked";
for(var i in downloads)
{
downloads[i].click(function()
{
if(!this.hasClass(className))
this.addClass(className);
else
this.removeClass(className);
});
}
({}).foo(). So which property evaluates to undefined, and why? Debug/fix the issue locally.$('.info').each.this. To turn the DOM element into a jQuery object that we can use jQuery methods on, we simply do$( this ), often following this idiom:var element = $( this );" Also: learn.jquery.com/using-jquery-core/selecting-elements/…