Discuss / JavaScript / 作业

作业

Topic source

老韩TY

#1 Created at ... [Delete] [Delete and Lock User]
var data = {};
$('#test-form').find('input').filter('[type!=radio]').each(function(){
    data[this.name] = this.value;
});
data.gender = $('input[name=gender]:checked').val();
data.city = $('select[name=city]').val();

json = JSON.stringify(data);

  • 1

Reply