jquery - How do I write .next() when wrapped in an extra div? -
i wrote fiddle, don't use .next()
when make sure button calls .next()
tucked in nice div.
when naked ex. <a href="#" class="add-sub">add</a>
it's fine.
when wrapped in div<div><a href="#" class="add-sub">add</a></div>
, line clone.appendto(jquery(el).next().find('.sub'));
doesn't work well.
i know easy little change, i've decided should ask question , little lesson in .next
when wrap need find next()
of wrapper element (you can use .parent()
wrapper)
clone.appendto(jquery(el).parent().next().find('.sub'));
demo: fiddle
Comments
Post a Comment