Search code examples
javascriptjqueryhtmlelementabbr

Get abbr inside element


I have this:

<th class="day-heading mon" scope="col">
  <abbr title="Lunes">L</abbr>
</th>

I need to access the abbr and change the innerHTML and title. How do I do that? I tried doing...

jQuery('.day-heading mon > abbr');

but I can't modify the properties from there.


Solution

  • just $("abbr").

    $("abbr").attr("title","something")
    $("abbr").html("stuff")
    

    If you want to select the "abbr" inside <th class="day-heading mon" >, do:

    $("th.day-heading.mon abbr")