jquery how to get form element types, names and values

前端 未结 5 1677
失恋的感觉
失恋的感觉 2020-12-30 07:34

I know I can get the name/value relationship by using

$(#form).serializeArray();

But is there a way to get the whole enchilada, type, name

5条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-30 08:11

    To get ALL form elements use

    $('input, textarea, select').each(function() {
        //   $(this).attr('type');
        //   $(this).attr('name');
        //   $(this).val();
    });
    

提交回复
热议问题