教程集 www.jiaochengji.com
教程集 >  jQuery  >  jquery 教程  >  正文 jquery 设置radio值的代码一例

jquery 设置radio值的代码一例

发布时间:2015-10-11   编辑:jiaochengji.com
为大家介绍一个使用jquery设置radio值的例子,供大家学习参考。

1、表单内容

<input id="dtype" value="text" type="radio" checked="checked" name="dtype"/> 单行文本 <input id="dtype" value="multitext" type="radio" name="dtype"/> 多行文本 <input id="dtype" value="datetime" type="radio" name="dtype"/> 时间类型 <input id="dtype" value="select" type="radio" name="dtype"/> 使用option下拉框 <input id="dtype" value="radio" type="radio" name="dtype"/> 使用radio选项卡 <input id="dtype" value="checkbox" type="radio" name="dtype"/> Checkbox多选框

2、jquery代码

<script language="javascript" type="text/javascript"> /** * 设置raido值 * www.jbxue.com */ $.each($("input[name='dtype']"),function(){ if($(this).val() =="text") { $(this).attr("checked","checked"); } }); </script>

以上就是今天Jquery 教程的内容,一个简单的jquery示例,建议大家亲自动手测试一下,看看效果如何。

您可能感兴趣的文章:
jquery 设置radio值的代码一例
jquery 获取表单元素里面的值示例代码
jquery实现radio的取值、radio的选中及radio重置(代码分享)
jQuery获取Radio,CheckBox选择的Value值(示例代码)
jQuery设置input type="radio"选中值
使用jquery获取radio的值
Jquery操作radio的小例子
jquery获取input表单值的代码
Jquery获取radio选中值的方法
ExtJS设置与获取radio控件的选取状态

[关闭]
~ ~