JQuery选择器

一、基本选择器
id选择器:KaTeX parse error: Expected 'EOF', got '#' at position 3: (“#̲id名称”); 元素选择器:(“元素名称”);
类选择器:$(“.类名”);
通配符:*
多个选择器共用(并集)
代码演示:

基本选择器

二、层级选择器
ancestor descendant: 在给定的祖先元素下匹配所有的后代元素(儿子、孙子、重孙子)
parent > child : 在给定的父元素下匹配所有的子元素(儿子)
prev + next: 匹配所有紧接在 prev 元素后的 next 元素(紧挨着的,同桌)
prev ~ siblings: 匹配 prev 元素之后的所有 siblings 元素(兄弟)

代码演示:

层级选择器

三、基本过滤选择器
(′li′).first()等价于:(′li′).first()等价于:(“li:first”)

代码演示:

层级选择器

四、属性选择器

代码演示:

属性选择器

五、表单选择器

代码演示:

表单选择器
</head>
<body>
    <input type="button" id="btn1" value="选择所有input元素" />
    <input type="button" id="btn2" value="选择文本框" />
    <br/>
    <form>
        <input type="text" /><br />
        <input type="checkbox" /><br />
        <input type="radio" /><br />
        <input type="image" /><br />
        <input type="file" /><br />
        <input type="submit" />
        <input type="reset" /><br />
        <input type="password" /><br />
        <input type="button" /><br />
        <select><option/></select><br />
        <textarea></textarea><br />
        <button></button>
    </form>
</body>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值