Tuesday, 15 July 2014

jquery change css class of 1 div with while you have multiple same names -


The problem is,

I have a 25 divs of seat for each loop in this way :]

  @forch (seats sr esus) {if (siosuped == true) {& lt; Div id = "@ s.SeatNumber @ r.RowNumber" class = "seat taken" & gt; & Lt; Img src = "~ / images / arm-chair.png" width = "25" height = "25" /> gt; & Gt; / Div & gt; } Else {& lt; Div id = "@ s.SeatNumber @ r.RowNumber" class = "seat free" & gt; & Lt; Img src = "~ / images / arm-chair page" width = "25" height = "25" square = "click f" /> gt; & Lt; / Div & gt; }}  

If you click More, I want to change the background color of 1 div or multiple, but when I make the background of all the 25 changes

  $ (document) .ready (function () {$ (". Seat"). Click (function () {$ (". Seat"). ToggleClass ("Highlight") ;});}); Code ($) below $ $ (this) Click the object of the div $ ("" in 
seat ")
  $ (document) .ready (function () { $ ("Seat"). Click (function () {$ (this) .toggleClass ("highlight");});});  

No comments:

Post a Comment