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>
查看全文
相关阅读:
QSerialPort类
初识Json
Qt plugins(插件)目录
Qt连接sql server数据库遇到的问题
串口通信中,QString 、QByteArray 转化需要注意的问题
Qt : 隐式数据共享(copy on write)
Ascii码 、16进制与 char
Caffe框架详细梳理
时间管理
Atom实用配置插件for C++
原文地址:https://www.cnblogs.com/liydotnet/p/1134240.html
最新文章
A 组队参赛
C 对抗赛
B 蒜头君的树
A 大地魂力
C 旅店
B [JLOI2012]树
A 现代艺术
静态路由和动态路由
指针和引用的区别
C++11特性-右值引用
热门文章
KMP算法
鸡尾酒排序
网易笔试题
利用二叉树求表达式的值
++i和i++的区别
菱形继承
二分图
QVaraint类
QSettings 类
Qt---坐标系统
Copyright © 2011-2022 走看看