Tuesday 15 July 2014

Jquery Each index stays at 0 -


There is a part of me in my script, where it ends through the number of elements in the list, and catch information Takes it, then puts it in a separate div for any reason before each loop will not count on its index. Ive tried many different ways to do this, but it seems that no one is working.

Here is the script:

  // Check each item for a list if ($ (Obj) .has ('& gt; ul')) { // Second level list $ (obj) .find ('& gt; ul') Each (function (index, obje) {// second level divisible base create element.appand ('& lt; div class = "level" id =' + index + 'style = "color:' + settings.startcolor + '; background : '+ Settings.startbg +'; font-size: '+ settings.baseFont +' px; position: absolute, width: 100%; height: 100%; 'gt; & gt; & gt; / div & gt; ; '); // Second level list item $ (obj) .find (' & gt; li ') .function (I, OBJ) {$ (' Level # 2 '). Attachment ("& lt; span & "+ $ (Obj) .find ('& gt;: first-child'). Text () +" & lt; / span & gt; ");})}};}  < / Pre> 

I need to make it So, it counts and keeps the name of a number from the last name of the divisor created by each ... Ive picked up my brain and did not know what is going wrong.

Your internal loop only adds .level # 2 , which is probably 'if you want me to correct my question If I'm studying in a manner, then this should work:

  $ (obj). Children ('ul'). Each (function (index) {var $ parent = $ ('& lt; div & gt;', 'class': 'level', id: index, css: {color: settings.startcolor, background: settings.startbg, FontSize: settings.baseFont + 'px', position: 'full', width: '100%', height: '100%'}}) Add (base element); $ (this). Child ('li') Each (function () {$ ('& lt; span & gt;', {text: $ (this). Child (). First () .text ()}). Attachment ($ parent);}) ;});    

No comments:

Post a Comment