Search code examples
javascriptjqueryasp.netcssrepeater

adding inline style to last li using jquery


I would like to add an inline style to the last LI that is generated with the ASP:repeater control.

I can't add a css class, i need to some how count the last li with the class called:

class="tile lower-boxes icon_email"

Solution

  • If I've understood your question, then the following should work for you:

    $(".tile.lower-boxes.icon_email:last").css("color", "#C00");
    

    Obviously, that selector and the CSS method can be changed to your needs. You can also add a class to the element, which would be preferable:

    $(".tile.lower-boxes.icon_email:last").addClass("foo");
    

    More info on the :last selector.