小白教程
所有教程
关于
Search
172.69.7.166
172.69.7.166
参数设置
贡献
退出
操作
编辑
移动
保护
信息
历史
删除
查看“Sel input checkbox”的源代码
本页内容
上一节:
Sel_input_radio
下一节:
Sel_input_submit
因为以下原因,您没有权限编辑本页:
您请求的操作仅限属于该用户组的用户执行:
用户
您可以查看和复制此页面的源代码。
{{DISPLAYTITLE::checkbox}}[[Category:jquery ref selectors|53]] = jQuery :checkbox 选择器 = [[jquery ref selectors|jQuery 选择器]] 选取所有带有 type="checkbox" 的 <input> 元素: <sample title="" desc="" lang="html" hererun="1"> $(":checkbox") </sample> <run name=""> <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>小白教程(xiaobai.wang)</title> <script src="https://cdn.staticfile.org/jquery/1.10.2/jquery.min.js"> </script> <script> $(document).ready(function(){ $(":checkbox").wrap("<span style='background-color:red' />"); }); </script> </head> <body> <form action=""> 名字: <input type="text" name="user"><br> 我有一辆自行车: <input type="checkbox" name="vehicle" value="Bike"><br> 我有一辆汽车: <input type="checkbox" name="vehicle" value="Car"><br> 我有一架飞机: <input type="checkbox" name="vehicle" value="Airplane"><br> <input type="submit"> </form> <p>注意:我们使用jQuery .wrap 方法来设置选中的元素高亮,Firefox 浏览器不支持复选框设置背景颜色。</p> </body> </html> </run> == 定义和用法 == :checkbox 选择器选取带有 type=checkbox 的 input 元素。 == 语法 == <pre> $(":checkbox")</pre> [[jquery ref selectors|jQuery 选择器]]
返回至“
Sel input checkbox
”。
上一节:
Sel_input_radio
下一节:
Sel_input_submit