jQuery 页面取值的问题
如何取得文本框、单选按钮以及复选框的值?
- <script type="text/javascript">
- $(function(){
- $("#btnSubmit").click(function(){
- var oTxtValue=$("#Text1").val(); //获取文本框的值
- var oRdoValue=$("#Radio1").is (":checked")?"男":"女"; //获取单选框按钮值
- var oChkValue=$("#Checkbox1").is (":checked")?"已婚":"未婚";//获取复选框按钮值
- $("#divTip").css("display","block").html(oTxtValue+"<br>"+oRdoValue+"<br>"+oChkValue); //显示提示文本元素
- })
- })
- </script>
- <div class="divFrame">
- <div class="divTitle">请输入如下信息</div>
- <div class="divContent">
- 姓名:<input id="Text1" type="text" class="txtCss"/><br />
- 性别:<input id="Radio1" name="rdoSex" type="radio" value="男" />男
- <input id="Radio2" name="rdoSex" type="radio" value="女" />女<br />
- 婚否:<input id="Checkbox1" type="checkbox" />
- <div class="divBtn"><input id="btnSubmit" type="button" value="提 交" class="btnCss" /></div>
- </div>
- </div>
- <div id="divTip" class="divTip"></div>
相关推荐
IT之家 2020-03-11
graseed 2020-10-28
zbkyumlei 2020-10-12
SXIAOYI 2020-09-16
jinhao 2020-09-07
impress 2020-08-26
liuqipao 2020-07-07
淡风wisdon大大 2020-06-06
yoohsummer 2020-06-01
chenjia00 2020-05-29
baike 2020-05-19
扭来不叫牛奶 2020-05-08
hxmilyy 2020-05-11
黎豆子 2020-05-07
xiongweiwei00 2020-04-29
Cypress 2020-04-25
冰蝶 2020-04-20