Why selecting first element from wrapped set is giving error ?
Please see this code:
- $(function(){
$("div.expandable").css("width",$("div.expandable")[0].width()+200)
});
as you can see i am first of all getting a wrapped set of all div whose class is set to expandable, and then calling method css to set width property of those all div to present width plus 200 pixel more.
The inner jQuery selector $("div.expandable") will also return a wrapped set so i used element at zero index to get its width $("div.expandable")[0].width() .
But this is returning error:
Webpage error details
User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 2.0.50727; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022; InfoPath.2; .NET CLR 3.0.4506.2152; .NET4.0C; .NET4.0E; .NET CLR 3.5.30729; msn OptimizedIE8;ENUS)
Timestamp: Mon, 21 Feb 2011 13:59:25 UTC
Message: Object doesn't support this property or method
Line: 15
Char: 1
Code: 0
URI: file:///C:/Documents and Settings/shyam/Desktop/jQueryAliasTest.html
Can you tell me why i am getting this error ?
Thanks