Get all text field value located in a specific class

后端 未结 5 1453
余生分开走
余生分开走 2020-12-24 11:51

I want to get all fields that are located in a single class name, for example my code like.

5条回答
  •  长情又很酷
    2020-12-24 12:13

    If you want all the values into an array, you can do this:

    var texts= $(".test .text-field").map(function() {
       return $(this).val();
    }).get();
    

提交回复
热议问题