//addPst表格名称
//查找所有input ,select 标签,遍历取值
$("#addPost").find("input, select").each(
function() {//遍历表格中的input、select等标签
if ($(this).attr("id")) {
//如果此标签设置了id,则取出其中数据
//radio的取一个
if ($(this).val() == null || $(this).val() == "" || $(this).attr("checked")) {
} else {
data += "\"" + $(this).attr("id") + "\":\""
+ $(this).val() + "\","; //拼接id和数据
}
}
});
遍历表格取值
最新推荐文章于 2024-12-30 19:45:00 发布