Is it possible to get the value of all elements returned by find or children without a loop?
There are several li that hide the hidden field, and we want to get all these hidden val fields.
i.e. var cats = $(this).next('ul').find('.hdn_id').val();
var cats = $(this).next('ul').find('.hdn_id').val();
But it returns only one value.
You need to iterate over the elements for simplicity . map () can be used.
Pass each element in the current matched set through a function, creating a new jQuery object containing the return values.
var cats = $(this).next('ul').find('.hdn_id').map(function () { return $(this).val(); }).get();
jQuery, , .get() .
.get()
.contents() .filter(function(){ return this.nodeType !== 1; })
Source: https://habr.com/ru/post/1651364/More articles:"IdentityContext" cannot be found (you are missing a using directive or assembly references) - c #Create UTF8 file without specification using Inno Setup (Unicode version) - utf-8Inno Setup Changing a text file and changing a specific line - inno-setupInno installation compiler: how to modify file contents - inno-setupReplace the placeholder in the installed text file with the user entered by the user - inno-setupSpark 2.0 Scala - RDD.toDF () - scalaInno Setup - How to edit a specific line from a text file during installation? - inno-setupIon tag does not display all text in Ionic2 - angularInno Setup: how to start the code procedure in the Run or Run section? - inno-setupjavascript: how to abort $ .post () - javascriptAll Articles