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

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -