JJ.
JJ.

Reputation: 9950

how do I select the following DOM items?

I want to select the highlighted items so that I can turn them green:

<script type="text/javascript">
     $(document).ready(function()
     {
         $('????').css("color", "green");
     });
</script>

Can somebody give me a hand?

Upvotes: 0

Views: 31

Answers (2)

jdepypere
jdepypere

Reputation: 3553

$(document).ready(function () {
    $('.k-in').css("color", "green");
});

As noted, it is advised to use css for styling. Check this example. You will see if a page takes longer to load, the second div that is styled with jQuery has black text first, because it takes a while for the jQ to be executed.

Upvotes: 1

Salvador Dali
Salvador Dali

Reputation: 222461

You need to select the element by it's class.

so $('.k-in') should do this

Putting it in your code:

$(document).ready(function(){
    $('.k-in').css("color", "green");
});

http://api.jquery.com/class-selector/

Upvotes: 2

Related Questions