Jquery get remove class on multiple elements exept last one -
OK, I have multiple selection boxes with "active_category" class, I want to remove the class from the final input.
I get this:
& lt; Input type = "text" category = "active_grad" /> & Lt; Input type = "text" class = "active_category" /> & Lt; Input type = "text" class = "active_category" /> & Lt; Input type = "text" class = "active_category" /> And I want to change it on:
& lt; Input type = "text" class = "" /> & Lt; Input type = "text" class = "" /> & Lt; Input type = "text" class = "" /> & Lt; Input type = "text" class = "active_category" /> This is my current JVC code for:
var count = 1; Var Total = $ (".ct_category") Length; $ (". Activ_category") Each (function () {if (calculated & lt; total) {$ (this) .removeClass ("active_category");} calculation ++;}); Is there a small way to do this ??
No need for every just : no < / Code> and : last use selectors: $ (". Activ_category: not (: last)"). RemoveClass ("Active_category")
Comments
Post a Comment