jQuery获取及设置单选框、多选框、文本框
来源:互联网 发布:云朵播放器网络原因 编辑:程序博客网 时间:2024/05/21 10:11
jQuery获取及设置单选框、多选框、文本框
获取一组radio被选中项的值
var item = $("input[@name=items][@checked]").val();
获取select被选中项的文本
var item = $("select[@name=items] option[@selected]").text();
select下拉框的第二个元素为当前选中值
$("#select_id")[0].selectedIndex = 1;
radio单选组的第二个元素为当前选中值
$("input[@name=items]").get(1).checked = true;
文本框,文本区域:$("#txt").attr("value");
多选框checkbox:$("#checkbox_id").attr("value");
单选组radio: $("input[@type=radio][@checked]").val();
下拉框select: $("#sel").val();
文本框,文本区域:$("#txt").attr("value","");//清空内容
$("#txt").attr("value","11");//填充内容
$("#chk2").attr("checked",true);//打勾
if($("#chk1").attr("checked")==undefined) //判断是否已经打勾
$("input[@name=radio_s][@value=16]").attr("checked",true);(测试通过)
下拉框select:
$("#sel").attr("value","-sel3");//设置value=-sel3的项目为当前选中项
$("11112222").appendTo("#sel")//添加下拉框的option
$("#sel").empty();//清空下拉框
$("#select1")[0].options(index).selected = true; //使第index个option选中
$("#select1")[0].options(3).text //取索引为3的option值
$(document).ready(function() { $("#btnSubmit").click(function() { alert($("input[name='RadioButtonList1']:checked").val()); }); });
<asp:RadioButtonList ID="RadioButtonList1" runat="server"> <asp:ListItem>1</asp:ListItem> <asp:ListItem>2</asp:ListItem> <asp:ListItem>3</asp:ListItem> </asp:RadioButtonList> <input id="btnSubmit" type="button" value="Submit" />
- jQuery获取及设置单选框、多选框、文本框
- jQuery获取及设置单选框、多选框、文本框
- jQuery获取及设置单选框、多选框、文本框
- jQuery框架获取及设置单选框、多选框、文本框内容
- jQuery框架获取及设置单选框、多选框、文本框内容
- jQuery框架获取及设置单选框、多选框、文本框内容
- jQuery框架获取及设置单选框、多选框、文本框内容
- jQuery获取及设置单选框、多选框、文本框内容
- jQuery获取及设置单选框、多选框、文本框内容
- jQuery获取及设置单选框、多选框、文本框内容
- jQuery获取及设置单选框、多选框、文本框内容
- jQuery获取及设置单选框、多选框、文本框内容
- Jquery获取设置radio select checkbox 文本框
- JQuery获取文本框值
- jQuery获取文本框数据
- JQuery获取文本框的值
- jquery 获取文本框中的文本
- JQuery获取设置内容及属性
- Coolite Extjs Store开发心得(转)
- c中的setjmp longjmp
- 有了这27种小技巧,人人可以成为大师
- HTTP代理原理以及HTTP隧道技术(经典)
- Windows平台下使用Android NDK进行开发
- jQuery获取及设置单选框、多选框、文本框
- Oracle序列使用:建立、删除
- 使用Aspose.Pdf处理现有的水印
- 小机器人5岁了!细数Android甜点史
- 多线程下载和断电续传
- 软件测试的科学
- C#日期处理
- Python Yield versus Return
- Makefile 之 wildcard用法: