# [jQuery] serialize() 排除空值 ###### tags: `jQuery` ```javascript! let str = $('#form').serialize(); //['test1=123', 'test2=41413', 'test3=dfgfdg', 'test4=sdsfgdf', 'test5='] console.log(str.split("&").filter(function(value) { console.log(value + "," + value.endsWith("=") + "," + typeof(value)); return !value.endsWith("="); })); //['test1=123', 'test2=41413', 'test3=dfgfdg', 'test4=sdsfgdf'] ```
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up