[jQuery] List from array
[jQuery] List from array
Hi.
I want co create simple HTML list with jQuery.
List of items is taken from array,
and those values should be also used for css color property value.
Now it looks like this:
colors = new Array('red', 'green', 'blue');
$(function() {
$.each(colors, function() {
$('#colors').append('<li>'+this+'</li>').css('color',
THIS);
});
})
Code shoud produce sth. like this:
<li style="color: red;>red</li>
<li style="color: green;>green</li>
<li style="color: blue;>blue</li>
How to do this?
--
takeshin