开发者

jQuery Object Serialize

What is the difference between this?

$("form").serialize();

and this?

var theForm = $("form");
$(theForm[0]).serialize();

How do you get the second sample to serialize like开发者_运维问答 the first one?


try this:

var theForm = $("form");
theForm.eq(0).serialize();


First one selects all forms and serializes all form fields.

Second one selects form fields from FIRST form and serializes them


Or you could use in one line:

$("form:first").serialize();

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜