jQuery获取选中内容及设置元素属性的方法

内容摘要
获取选中select :




$("#id option:selected").val();

自定义radio:




$("input[name=sex][value="+data.sex+"]").attr("checked",true);

获取radio:




$("input[
文章正文

获取选中select :

$("#id option:selected").val();

自定义radio:

$("input[name=sex][value="+data.sex+"]").attr("checked",true);

获取radio:

$("input[name='sex']:checked").val()

设置input不能编辑:

$("#cashNum").attr("disabled","disabled");


代码注释

作者:喵哥笔记

IDC笔记

学的不仅是技术,更是梦想!