I have my HTML like this:
<table>
<caption class="my_caption">Table 1.1: TABLE CAPTION</caption>
<tr>...</tr>
<tr>...</tr>
...
I need to get the caption text so I can make some string comparison. I've tried doing .val(), .text(), .html() and .value but none of them work.
Thanks for your help.
EDIT: I actually have a few of those captions. Sorry, I should've mentioned this earlier.
<div>
<table>
<caption class="my_caption">Table 1.1</caption>
<tr>...</tr>
<tr>...</tr>
...
</table>
<table>
<caption class="my_caption">Table 1.2</caption>
<tr>...</tr>
<tr>...</tr>
...
</table> </div>
So I have a for -loop that goes through all the captions:
var cap_tables = $("caption.my_caption");
for (var i=0;i<cap_tables.length;i++) {
alert(cap_tables[i].text());
//i've tried .text(), .html(), .val(), .value to get the caption text
}
I will try again will all your suggestions and get back to you guys. Thank you very much!!!
I am using Firefox version 3.5.3