javascript - Jquery - dynamic div counter inside another dynamic div counter -
this unusual 1 , 1 can't seem head around in terms of logic needed.
i have div dynamically added , has counter associated can created multiple times , need uniquely referenced inputs.
inside these divs set of divs dynamically created , 1 time again need counted individually inputs. these internal divs have have local counter master div e.g:
<div id="master1"> <div id="master1sub1"> <div id="master1sub2"> <div id="master1sub3"> </div> <div id="master2"> <div id="master2sub1"> <div id="master2sub2"> </div> as unable predict how many masters , how many subs each master have unsure how count these dynamically.
can help?
kind regards, eamon
you can loop them so:
$("[id^=master]").each(function() { //looping parent divs $(this).children("div").each(function() { //looping sub divs }); }); ideally, add together mutual class parents, such class="parent-counter" , class kid counters (class="child-counter") , them count them way
javascript jquery html dynamic counter
No comments:
Post a Comment