Skip to content

Instantly share code, notes, and snippets.

@woosungchu
Created November 3, 2016 00:48
Show Gist options
  • Select an option

  • Save woosungchu/2755e8dfcbb2b9af5b62c2ba900d449c to your computer and use it in GitHub Desktop.

Select an option

Save woosungchu/2755e8dfcbb2b9af5b62c2ba900d449c to your computer and use it in GitHub Desktop.
data = $form.serializeArray();
console.log($jq.grep(data, function(e){ return e.name == 'apprTitle'; }));
// Array[1]0: Objectname: "apprTitle"value: "untitled"
//What I expect is empty value.... but it log 'untitled'
//apprTitle catch null
$jq.each(data, function(i,item){
if(item.name === 'apprTitle'){
if(item.value === '') item.value= 'untitled';
return false;
}
});
console.log($jq.grep(data, function(e){ return e.name == 'apprTitle'; }));
// Array[1]0: Objectname: "apprTitle"value: "untitled"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment