asp.net - Adding css styles to dynamically generated items (jquery , css) -


i have problem styling dynamically generated items. here example of grid items.

enter image description here

i need add different classes (styles) grid rows, in specific sequence. first row grey, next 2 rows blue, next 2 grey again , on. have no idea how that. maybe there jquery selectors?

try thing like

var classes = ['grey', 'blue', 'blue', 'green', 'red'];  var els = $('<div />').text(4).appendto('#x');  $(els).addclass(function(index, cl){     return classes[ $(this).index() % classes.length ] }) 

demo: fiddle


Comments

Popular posts from this blog

php - mySql Join with 4 tables -

css - Text drops down with smaller window -

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -