jquery学习(一)

jQuery
选择器简介
•兼容CSS3选择器标准
•对选择器语法有更多扩充
•返回0、1或多个jQuery元素的集合
•集合内元素顺序和在页面上顺序一致
 
位置筛选器
:first
:last
:even
:odd
:eq(n)
:gt(n)
:lt(n)
 
子元素筛选器
:first-child
:last-child
:first-of-type
:last-of-type
:nth-child()
:nth-last-child()
:nth-of-type()
:nth-last-of-type()
:only-child
:only-of-type
 
表单筛选器
:checked
:disabled
:enabled
:focus
:button
:checkbox
:file
:image
:input
:password
:radio
:reset
:selected
:submit
:text
 
内容筛选器
:empty
:contains(text)
:has(selector)
:parent
 
其他筛选器
:lang(language)
:not(selector)
:root
:target
:hidden
:visible
:header
:animated
 

<body>
<div class='box1' id="box3">box1</div>
<div class="box2">box2</div>
<input type="text" name="username">
<script src="vendor/jquery-1.12.4.js"></script>
<script>

返回的是类数组的集合对象,类数组是具有长度的属性
$(function(){

$('box1').addclass('highlight')
var element1 = $('box1');
var element2 = $('.box1,.box2');
var element3 = $('[name="username"]');
var element4 = $('div');
var element5 = $(document.getElementById('box3'));
console.log(element1);
console.log(element2);
console.log(element3);
console.log(element4);
console.log(element5);
})
</script>

转载于:https://www.cnblogs.com/EmilyGarden/p/8508648.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值