开发者

JQuery serialize function with an empty input field that has a title attribute

开发者 https://www.devze.com 2023-02-09 10:00 出处:网络
I have 开发者_Go百科the following form input field: <input type=\"text\" value=\"\" title=\"Enter item description\" name=\"description\">

I have 开发者_Go百科the following form input field:

<input type="text" value="" title="Enter item description" name="description">

When I call JQuery's serialize function on the containing form, it gives me the following:

description=Enter+item+description

Does anyone know why serialize() takes the title as a value for the description field? How can I get around this? I want the result to be:

description= (i.e. no value)


Thats not the behavior of serialize(). I think you may have another plugin or code that is loading the value of the title tag into the value of the field. I know there are many plugins that use the value to create ghost text or to do a mask on the input field. That maybe causing it to be considered the value when you use serialize(). I actually just tested it and it works as expected. See here: http://jsfiddle.net/XrVvM/

0

精彩评论

暂无评论...
验证码 换一张
取 消