if there is no valid option selected(that is Male or Female in this case), FormDataJson.toJson("#searchForm", {skipEmpty: true}) still return gender with null, what I suppose is to skip gender. I tried to change <option value="" selected></option> to <option ></option>, still not work.
I am using
FormDataJson.toJson("#searchForm", {skipEmpty: true})
, but I found that forselect
option:if there is no valid option selected(that is Male or Female in this case),
FormDataJson.toJson("#searchForm", {skipEmpty: true})
still returngender
with null, what I suppose is to skipgender
. I tried to change<option value="" selected></option>
to<option ></option>
, still not work.how can I skip non selected
select
element?