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

2020-05-22 16:37:01易采站长站整理

获取选中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");