jquery selector for div with class
javascript, jquery
Solution
// all divs with tab_select class
$('div.tab_select')
// first div with tab_select class
$('div.tab_select:first')
// or CSS pseudo selector which is slightly faster than the first jQuery
// shortcut
$('div.tab_select:first-of-type')
// or
$('div.tab_select').first()
// or
$('div.tab_select:eq(0)')
// or
$('div.tab_select').eq(0)
Problem
I tried this below. I think the return Object of $("div.tab_select")[0] isn't a jQuery Object, but I can't even use pure javascript method. Is there any way to make it jQuery Object? for instance $($("div.tab_select")[0])..I know this's silly; Thank you for reading. ``` var tmp = $("div.tab_select")[0]; alert(tmp); //This gives me HTMLDivElement collectly. But I can't use any of javascript.. alert(tmp.nodeName); //But this give me error "Uncaught TypeError: Cannot read property 'nodeName' of undefined" tmp.hide(); //Neither, I can't use this. ```