I have a question.
How would i iterate through each h2 in their div, grab their text value and appending that to the other set of divs in the order that they appear on the other side?
i could use eq or something and go through each one but this isn’t ideal as the number of divs at any given time could be more or less and i’ll only have to go back and adjust the js to adjust for the number of divs.
There is no js i’ve done yet in this example just because i’m not sure how to approach this.
Any help is appreciated.
Thanks
I think using
.eqis your only choice, but it does not make your code inflexible:DEMO
Additional
divs will be just left empty and too fewdivs are not a problem either..eqwill always return a jQuery object, even if an element with that index does not exist. The call to.textwill then just be silently ignored.Or do you want to always have as many
divs ash2s?