Discuss / JavaScript / 作业

作业

Topic source

WUDAJUN

#1 Created at ... [Delete] [Delete and Lock User]

json={}; $('#test-form:input[type!=submit]') .map(function(){ if (this.type==="radio"){ json[this.name]=$(this).parent().text(); }else if(this.type==="select-one"){ json[this.name]=$(this).find("option:selected").text(); }else{ json[this.name]=this.value; } }); json = JSON.stringify(json);


  • 1

Reply