setting color of a link in javascript -


i want set color of "val" in link in below code.

var link = $('<a href="#" class="album">' + val + '</a><br><br>');//this link link.style.color="red";//this how iam trying set color of "val" 

so how it.

you can this:

link.css({ color: 'red' }); 

but correct , nice way be:

$(".parent_element").prepend('<a href="#" class="album">'+val+'</a><br><br>'); $(".parent_element > a:first").css({ color: 'red' }); 

Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -