I am interested in adding a colorful border-top to my menu using jQuery. I know this can be achieved with HTML by including style="border-top-color: red;"
, but I want to explore the jQuery method.
Here is what I have attempted so far:
var colors = ['purple', 'yellow', 'orange', 'black'];
for(int i=0; i<4; i++){
$("li").html("<a style= 'border-top-color: colors[i]'>");
I also tried replacing $("li")
with $("a")
but it did not work as expected.
Does anyone have any suggestions or solutions for achieving this effect using jQuery? Thank you!