如何从jquery选择器获取dom元素? [英] how to get dom element from jquery selector?

查看:97
本文介绍了如何从jquery选择器获取dom元素?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望你的2015年很棒,并且事先感谢你花一点时间来帮助我,首先,我是一个自己学习的菜鸟......所以如果我的话请耐心等待我编程逻辑它不符合你的期望,或者我是否混淆概念,当然可以随意纠正我,谢谢!





如何定位符合这种条件的元素?



我有下一个代码:



if($(。class)。is(':visible')&&!$(。class)。hasClass('match_group')){

/// target这些元素在这个具体条件下,我想达到的目标意味着做一些事情,例如:



$(。class)。is(':visible')。css ({'background-color':'blue'}):



甚至更好地附上一个事件处理程序如果可能

}

解决方案

(。class)。is(':visible')&&!


(。class)。hasClass('match_group')){

///瞄准具有该特定条件的那些元素,我想达到的目标意味着做一些事情,例如:



(。class)。is(':visible')。css({'background-color':'blue'}) :



甚至更好地附上一个事件处理程序如果可能

}


I hope your 2015 it's being awesome and thank you from beforehand for taking a minute of your time to help me, first of all, I'm a noob who's been learning by my own...so bear with me if my programming logic it's not up to your expectations or if i'm confusing concepts and of course feel free to correct me, thanks!


how can I target the elements that match such condition?

I've got the next code:

if($(".class").is(':visible') && !$(".class").hasClass('match_group')){
/// target those elements with that specific condition, the goal I wanna reach implies doing things like for example:

$(".class").is(':visible').css({'background-color':'blue'}):

or even better attatch a event handler if posssible
}

解决方案

(".class").is(':visible') && !


(".class").hasClass('match_group')){
/// target those elements with that specific condition, the goal I wanna reach implies doing things like for example:


(".class").is(':visible').css({'background-color':'blue'}):

or even better attatch a event handler if posssible
}


这篇关于如何从jquery选择器获取dom元素?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆