Best way to find all input elements inside a form using jQuery

前端 未结 1 1911
Happy的楠姐
Happy的楠姐 2021-02-04 06:39

I need to find all form elements inside inside a form and trigger a flag on change in the value. Currently I am using the method below. I am not sure if this works or not. But I

1条回答
  •  情深已故
    2021-02-04 07:18

    Try this:

    $('#form').find(':input').each(function(){
      $(this).change(function(){
        if( change !== 1 ) change = 1;
      });
    })
    

    Check the doc @:

    http://api.jquery.com/input-selector/

    0 讨论(0)
提交回复
热议问题