0

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.

Andy
  • 61,948
  • 13
  • 68
  • 95
WhiteFloater
  • 137
  • 1
  • 1
  • 10
  • 2
    if you want the selector to be on both classes do jQuery('.day-heading.mon > abbr'); (without the space and put in a period). Once you have the correct selector you can use .attr() and other functions – tabz100 Mar 26 '15 at 15:24

2 Answers2

0

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")

Jeremy Thille
  • 26,047
  • 12
  • 43
  • 63
  • 3
    What if there are bunch of them on the page? The OP seems to be specific about that selector. – Andy Mar 26 '15 at 15:25
0

You can edit the inner HTML of selected elements with the .html() jQuery function and their title attributes with .attr() jQuery function. Therefore, you could do:

$('.day-heading mon > abbr').attr("title", "HST")
$('.day-heading mon > abbr').html("Hubble Space Telescope")
Kad
  • 639
  • 8
  • 25