jQuery实例代码-表单相关
2024-09-27 12:14:31
select option
获取选中项的文本值
$("#ddl_GoOutReasonType option:selected").text()
根据索引定于option项
$("#dplHb_Dw").find("option").eq(1).attr('selected','selected');
赋值定位(编辑时的常用操作)
$("#ItemType").prop("value", dtResult.ItemType);
方式二:
$("#"+selectID).find("option[value='"+dataVal+"']").attr("selected",true);
//根据value找option的text
$("#EnablePuzzle").find("option[value='" + puzzleObj.EnablePuzzle + "']").text();
checkbox
判断是否选中
$(this).is(':checked') 或 $(this)[0].checked
if ($(chkObj).is(':checked') == true)
input type=radio 和 select option 结合
操作input type=radio 定位 select option
$(function () {
$("input[name=rblBackMoneyType]").bind("click", function () {
if($(this).val() == 0)
{
$("#dplHb_Dw").find("option").eq(1).attr('selected','selected');
}
else
{
$("#dplHb_Dw").find("option").eq(0).attr('selected', 'selected');
}
});
})
最新文章
- Redis 与 数据库处理数据的两种模式
- 多种坐标系之间的转换 Proj.NET和DotSpatial
- SharePoint 2013 文档库中PPT转换PDF
- LeetCode:Find the Difference_389
- jquery serialize()方法可以序列化表单值为字符串
- ubuntu的命令day1
- matlab怎么定义一个数组
- GPL协议的MySQL数据库
- PCA和白化练习之处理图像
- UI3_UIbarButtonItem
- 【Node.app】Node.js for iOS
- LeetCode 45
- nodejs 递归创建目录
- 安装Visual Studio 2010 - 初学者系列 - 学习者系列文章
- 使用supervisor管理进程
- Java虚拟机-类文件
- UIWebView的常用方法
- 【kindle笔记】之 《犬夜叉》-2017-12-26
- vMware 按装 MacOs
- SQLServer2012数据库降级至SQLServer2008R2的方法
热门文章
- 难道调用ThreadPool.QueueUserWorkItem()的时候,真是必须调用Thread.Sleep(N)吗?
- bzoj 2115 [Wc2011] Xor——路径和环的转化
- Python collections系列之单向队列
- Azure ASM到ARM迁移 (三) Reserved IP的迁移
- UEditor富文本编辑器的图片上传 http://fex.baidu.com/ueditor/#server-deploy
- Spring集成Quartz定时任务框架介绍
- Python类(七)-类的特殊成员方法
- python window使用paramiko简单监控数据指标数据采集
- windows cmd for paramiko
- SpringMVC工作原理图解