zoukankan
html css js c++ java
JQuery:单选框,复选框取值
<
div style
=
"
100%; border:solid 1px #0000ff; line-height:25px
"
>
<
input type
=
"
radio
"
name
=
"
items
"
id
=
"
item1
"
value
=
"
1
"
checked
=
"
checked
"
/
>1
<
input type
=
"
radio
"
name
=
"
items
"
id
=
"
item2
"
value
=
"
2
"/
>2
<
input type
=
"
radio
"
name
=
"
items
"
id
=
"
item3
"
value
=
"
3
"/
>3
<
input type
=
"
radio
"
name
=
"
items
"
id
=
"
item4
"
value
=
"
4
"/
>4
<
input type
=
"
radio
"
name
=
"
items
"
id
=
"
item5
"
value
=
"
5
"/
>5
<
br
/
>
<
input id
=
"
bt_radio
"
type
=
"
button
"
value
=
"
单选框测试
"
>
<
script type
=
"
text/javascript
"
>
$(document).ready(
function
()
{
$(
"
#bt_radio
"
).click(
function
()
{
alert($(
"
input[@name=items][@checked]
"
).val());
}
)
}
)
<
/
script>
<
/
div>
<
br
/
>
<
div style
=
"
100%; border:solid 1px #0000ff; line-height:25px
"
>
<
input type
=
"
checkbox
"
name
=
"
cbType1
"
id
=
"
cbType1
"
value
=
"
1
"
checked
/
>1
<
input type
=
"
checkbox
"
name
=
"
cbType1
"
id
=
"
cbType2
"
value
=
"
2
"
/
>2
<
input type
=
"
checkbox
"
name
=
"
cbType1
"
id
=
"
cbType3
"
value
=
"
3
"
checked
/
>3
<
input type
=
"
checkbox
"
name
=
"
cbType1
"
id
=
"
cbType4
"
value
=
"
4
"
checked
/
>4
<
br
/
>
<
input id
=
"
bt_checkbox
"
type
=
"
button
"
value
=
"
多选框测试
"
>
<
script type
=
"
text/javascript
"
>
$(document).ready(
function
()
{
$(
"
#bt_checkbox
"
).click(
function
()
{
var
aa
=
""
;
$(
"
input[@name=cbType1][@checked]
"
).each(
function
()
{
aa
+=
$(
this
).val()
+
"
,
"
;
}
)
alert(aa);
}
)
}
)
<
/
script>
<
/
div>
<
br
/
>
<
div style
=
"
100%; border:solid 1px #0000ff; line-height:25px
"
>
<
input type
=
"
checkbox
"
name
=
"
cbType2
"
id
=
"
cbType21
"
value
=
"
1
"
checked
/
>1
<
input type
=
"
checkbox
"
name
=
"
cbType2
"
id
=
"
cbType22
"
value
=
"
2
"
/
>2
<
input type
=
"
checkbox
"
name
=
"
cbType2
"
id
=
"
cbType23
"
value
=
"
3
"
checked
/
>3
<
input type
=
"
checkbox
"
name
=
"
cbType2
"
id
=
"
cbType24
"
value
=
"
4
"
checked
/
>4
<
br
/
>
<
input id
=
"
bt_checkbox2
"
type
=
"
button
"
value
=
"
多选框测试2
"
>
<
script type
=
"
text/javascript
"
>
$(document).ready(
function
()
{
$(
"
#bt_checkbox2
"
).click(
function
()
{
var
aa
=
""
;
$(
"
input[@name=cbType2]
"
).each(
function
()
{
if
(
this
.checked)
{
aa
+=
this
.value
+
"
,
"
;
}
}
)
alert(aa);
}
)
}
)
<
/
script>
<
/
div>
查看全文
相关阅读:
团队管理(八)
VantUI 二级标签栏
easyui combobox动态添加数据的问题
easyui combobox选中的问题
读书笔记:周鸿祎我的互联网方法论
读书笔记:Information Architecture for the World Wide Web, 3rd Edition 北极熊 第一部分 1-3
读书笔记:Information Architecture for the World Wide Web, 3rd Edition 北极熊 简介
网页设计中11 款最好CSS框架
科普:google的数字图书馆
实用总结,如何截取翻屏网页
原文地址:https://www.cnblogs.com/liydotnet/p/1134240.html
最新文章
php连接mysql
微信公众号css布局和SVG推文的一些坑
H5 跳转 小程序
判断IOS13.4以上系统是否是相机拍照上传的图片
van 地址选择器(Area)设置默认值
在 vue 中使用 animate.css 最新版本
html2canvas 在IOS系统13.4以上失效的问题解决方法
JS Date对象在IOS系统下的问题
PIXI 场景模糊解决方法
moment.js 的一些方法
热门文章
H5在部分苹果手机IOS系统下重力感应无效
在线引用js资源积累
jq slideToggle()坑
JS 树结构数据解构成平面数据 Tree to Array<primary>
dayjs笔记
liquidFill+pie组合图
echarts 实现在柱状图绘制标注点
VantUI 图片放大预览的两种方式
团队管理(九)
vant tab标题选中状态样式设计
Copyright © 2011-2022 走看看