Hey guys ,

While playing with jquery i've come across the following situation :

$(document).ready(function(){

	$("div")[0].css("background-color","blue");
});

I get an error everytime i try to call any method on a particular element from the wrapper set .

I tried with the get()

$("div").get(0);

Same stuff .

I can't spot what the problem is .

Thank u

I found out what the problem is .

When getting an element from the wrapper set ( by index array notation or by get(index ) ), it returns a javascript element , NOT a jquery object and thus everytime i try to call a method from the jquery library on the extracted javascript element i get an error like ( " method name is not a function " ).

The solution to my problem :

$(document).ready(function(){

$("div:first").css("background-color","blue");

});

I hope this topic will help others that ran over the same problem .

Many thanks to redsquare from the jquery irc channel for all the help .

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.