jQuery to serialize only elements within a div

后端 未结 8 1776
猫巷女王i
猫巷女王i 2020-11-28 20:52

I would like to get the same effect as jQuery.serialize() but I would like to return only the child elments of a given div.

Sample

8条回答
  •  情歌与酒
    2020-11-28 21:28

    serialize all the form-elements within a div.

    You could do that by targeting the div #target-div-id inside your form using :

    $('#target-div-id').find('select, textarea, input').serialize();
    

提交回复
热议问题