I know serialize works with <FORM> but can it work for DIVs as well?
<div class="row" shortname="1"></div>
<div class="row" shortname="2"></div>
<div class="row" shortname="3"></div>
<div class="row" shortname="4"></div>
How can I grab all the DIV and its shortname attribute and pass everything to an AJAX post?
Like shortname=1&shortname=2&shortname=3
Thanks!
No, it cannot work with divs so you’ll have to create a solution. If I can assume that these divs are wrapped in a parent div, then this code will work
If they are not wrapped in a div, and you want to find all the divs that have the shortname attribute, change the loop to this.
note: I’m thinking you want the shortname to be an array. If you constuct without brackets, you may be overwriting the value of “shortname” over and over.