jquery动态创建json

来源:互联网 发布:域名价格排行榜 编辑:程序博客网 时间:2024/05/22 10:40
1.jquery动态创建json

var data = {};//声明一个json对象inputs.each(function(){if( $(this).index != 6){dataKey = $(this).attr("name");dataValue = $(this).val();data[dataKey] = dataValue;//动态添加}});


2.JQuery获取和设置Select选项

获取select 选中的 text: 

$("#cusChildTypeId").find("option:selected").text(); $("#cusChildTypeId option:selected").text()

获取select选中的 value:
 $("#ddlRegType ").val();

清空 Select:
$("#cusChildTypeId").empty();

或者

$("#cusChildTypeId").get(0).options.length = 0;  


0 0