javascript - How I can add a counter after adding a new - to my list using jquery -
After adding a new row at the top of my list, I try to apply a dynamic counter to add to my list The code is not working properly because it is wrong, for example if we have this list
- A
- b
-
And I will add D instead of making it like this
- D
- A
- A
- Come
- c
Relationship I want to delete the last line if I down a new line add, but what is not working no one knows why?
A A variable that holds the content that I want to prepaid
$ (". Il_admin -" + id) .prepend (html) .slideDown ("slow"), a ???? Var i = GetURLParameter ("paged"); Var calculation = (i * 10) -10; JQuery ("Il_admin li"). Each (function (i) {i = count + i; var text_attreibute = $ (this) .find (".l_admin_raw_count"); $ (text_attreibute) .html (i + 1);}); Var size = $ ('. Il_admin li') Size (); If (size> 10) {var last_row = $ ('. Il_admin li'). last (). Attr ('class'); $ (LAST_ROW) .remove (); }
jQuery (".l_admin li") each. (Function) {Var text_attreibute = $ (this) .find (".l_admin_raw_count"); $ (This) .html (parseInt ($ (this) .index ()) + 1 + '.' + Text_attreibute);});
Since you voted for a long time, you have to force an audience on your list change to refresh the pointer. Try it:
jQuery (document) .on ("change", ".il_admin", function (i, list_li) {// will call your DOM every time in your .il_admin Change (= you've added a new line) $ (list_li) .each (function (j, li) {var text_attreibute = $ (li) .find (". Il_admin_raw_count") var output = parseint ($ (li) Index ()) + 1 + '.' + Text_attreibute; if (output! = $ (.html)). Html again and Are our listeners say again $ (li). HTML (output);}}}.
Comments
Post a Comment