Iterate through all form elements irrespective of their type

前端 未结 2 442
渐次进展
渐次进展 2021-01-22 05:20

I am busy with a form manager for one of our clients. The general idea is that forms will be built for the individual departments and I want to create a micro system which will

2条回答
  •  逝去的感伤
    2021-01-22 05:53

    Try this:

    //loop through all input elements
    $("form :input").each(function(){
        var thevalue = $(this).val();//the value of the current input element
        var thename = $(this).attr('name');//input name
        var thetype = $(this).attr('type');//input type
    });
    

提交回复
热议问题