伪类选择器:checked将作用与input类型为radio或者checkbox以及option
2018-02-23 10:57
323 查看
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no"> <title>伪类选择器:checked将作用与input类型为radio或者checkbox以及option</title> <style type="text/css"> option:checked {color: red;} input:checked + span {background: #f00;} input:checked + span:after{content:" 我被选中了";} </style> </head> <body> <select> <option>Volvo</option> <option selected="selected">Saab</option> <option>Mercedes</option> <option>Audi</option> </select> <div><input type="radio" name="sex" value="male" checked><span>Male</span><div> <div><input type="radio" name="sex" value="female"><span>Female</span></div> <div><input type="checkbox" name="group" value="red" checked><span>red</span><div> <div><input type="checkbox" name="group" value="blue"><span>blue</span></div> <script src="https://cdn.bootcss.com/jquery/3.2.1/jquery.js"></script> <script type="text/javascript"> </script> </body> </html>
备注:欢迎加入web前端求职招聘qq群:668352707
相关文章推荐
- jQuery表单选择器(:input/:text/:password/:radio/:checkbox/:submit/:image/:checked/:selected)
- IE里input元素type为checkbox与radio的checked=true失效
- 控制input的CSS但不影响CheckBox以及Radio的样式
- 控制input的CSS但不影响CheckBox以及Radio的样式
- 如何实现控制input的CSS但不影响CheckBox以及Radio的样式
- js/html中input、text、redio、checkbox、file、option以及textarea标签的使用
- radio或者checkbox使用jquery的attr(checked)一直为undefined
- jquery表单选择器input、:text、:password、:radio、:checkbox、:submit、:reset、:image、:button、:file、:hidden
- textarea、radio,checkbox以及option的取值和赋值
- css3使用checked伪类隐藏传统的radio和checkbox
- 如何点击文字,把input type="radio" 或者 input type="checkbox" 也选中
- 怎样在radio类型的input标签中动态的加checked
- input类型Checkbox复选款全选和取消
- jquery取得text,areatext,radio,checkbox,select的值,以及其他一些操作
- Jquery 获取checkbox的checked问题以及解决方案
- js操作input控件【radio、checkbox】
- Objective-C 2.0 with Cocoa Foundation--- 5,Class类型,选择器Selector以及函数指针
- 织梦自定义字段【option下拉框】【radio选项卡】【Checkbox多选框】默认值过多无法显示解决方法
- Objective-C 2.0 with Cocoa Foundation--- Class类型,选择器Selector以及函数指针(3)
- linux 文件结构,和各目录的作用,以及文件的类型