I have created a JSFiddle for this problem and I only got it working when I added the required <table>
and <tr>
statements around the <td>
element:
<table>
<tr>
<td class="HiddentText" style="display: none;">My Hidden Text</td>
</tr>
</table>
Then you can do:
$(document).ready(function() {
alert($('.HiddentText').html());
});
See my working JSFiddle: http://jsfiddle.net/kgjux/
And my non-working JSFiddle (which does not have the <table>
and <tr>
elements): http://jsfiddle.net/44Unf/