##$("*") means getting all objects( Generally not used)
$("#XXX") 'Get the element object with id=XXX (Commonly used)
##$(".XXX")
'Get the element object of class=XXX(commonly used)
$("p") ' Tag selector selects all p elements (commonly used) ##$("input[name='uname']") Get The element object with name='
uname' in the input tag (commonly used) such as:
self.find("input[name='complany']").css('border','#FFB240 1px solid'); self.find("textarea[name='messcont']").css('border','#FFB240 1px solid');
. For usage rules, you can refer to here (http://www.php. cn/) In this blog post, I forgot to add the use of comma combination. Here is a case of using comma combination If you want to get p with class message, the code is as follows:
<p class="message"> gegrew </p> <span class="message">ageaw</span> <script type="text/javascript" src="js/jquery-1.7.1.min.js"></script> <script type="text/javascript"> console.log($(".message,p").html()) ; </script>
$("Element[attribute != 'ceshi']") Gets all elements with a certain attribute that is not
ceshi$("Element[attribute ^= 'ceshi']") Gets all elements that have an attribute that does not start with
ceshi$("Element[attribute *='ceshi']" 'Get all elements
## with an attribute starting with ceshi #<span class="message" src="hello">hello</span>
<span class="message" src="byebye">byebye</span>
<script type="text/javascript" src="js/jquery-1.7.1.min.js"></script>
<script type="text/javascript">
console.log($("span[src ='hello']").html()) ;
</script>
$("Element").attr(key) 获取某一个元素的属性
$("Element").attr(key,value) 给某一个元素设置属性
以上就是关于Jquery获取对象的属性与值的内容,更多相关内容请关注PHP中文网(m.sbmmt.com)!