Discuss
/
JavaScript
/
看了评论才理清
看了评论才理清
Topic source你这有BUG,修正如下
var obj ={};
$('#test-form :input').filter(function(){
if (this.type !=='submit' &&this.type !== 'radio')
{
return this;
} else if (this.type === 'radio' && this.checked) {
return this;
}
}).map(function(){
return obj[this.name] = this.value;
})
json = JSON.stringify(obj);
- 1
_啊狗
var obj ={};
$('#test-form :input').filter(function(){
return this.type !=='submit' || this.checked
}).map(function(){
return obj[this.name] = this.value;
})
json = JSON.stringify(obj);