表单 select 获取数据优化

feat/task1-c-wallet
Devil 2021-05-18 21:35:24 +08:00
parent 2ec869df97
commit c1b35f2092
1 changed files with 5 additions and 2 deletions

View File

@ -104,7 +104,7 @@ function GetFormVal(element, is_json)
var name = $(this).parents('select').attr('name');
if(name != undefined && name != '')
{
if($(this).is(':selected') && tmp.value != undefined && tmp.value != '')
if($(this).is(':selected'))
{
// 多选择
if($(this).parents('select').attr('multiple') != undefined)
@ -118,7 +118,10 @@ function GetFormVal(element, is_json)
i++;
} else {
// 单选择
object.append(name, tmp.value);
if(object[name] == undefined)
{
object.append(name, tmp.value);
}
}
}
}