How do I use jQuery selectors with an object?

I have an unordered list in an object: var myUL = $('ul#theID'); //I send this var to another function in the code I want the direct children only of this object (I have another 'ul' within each 'li' that also has 'li's in it), but this selector does not work: $(myUL + '>li').each( etc, etc... It gives me the error "uncaught exception: Syntax error, unrecognized expression: [object Object]" on this selector in Firebug. If I use $('li', myUL) it gives me ALL of the 'li's withing the ul, not just the direct children, which is not what I want. I only want the direct children. What is the correct syntax?

以上就是How do I use jQuery selectors with an object?的详细内容,更多请关注web前端其它相关文章!

赞(0) 打赏
未经允许不得转载:web前端首页 » jQuery 答疑

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

前端开发相关广告投放 更专业 更精准

联系我们

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏