charan
charan

Reputation: 1

jquery - how to get the value

My Table is Like This, I want to Get the value it is between <a> and </a>,Any one can help me please,Thank you.

   <table id="depart_me" class="tbl1" cellspacing="0" cellpadding="5" border="0" width="100%">
    <tbody>
    <tr class="rower bgyellow">
    <td width="4">&nbsp;</td>
    <td width="30">
    </td>

    <td colspan="4">
        Hai
    </td>

    <td bgcolor="#e2fdba" style="-moz-border-radius: 10px 10px 10px 10px; text-align: center; width: 100px;">
    <div class="d_totprice" align="center" style="margin-left: 10px; float: left;">
    <a class="farebreakup" href="javascript:void(0);">5996</a>
    </div>
    </td>

    </tr>
    </tbody>
    </table>

Upvotes: 0

Views: 113

Answers (3)

dSquared
dSquared

Reputation: 9825

Use the following:

var value_of_anchor = $('a.farebreakup','#depart_me').text();

Hope it helps.

Thanks to Šime Vidas for the inspiration and to ipr101 for pointing out the typo!

Upvotes: 1

ipr101
ipr101

Reputation: 24236

Using jQuery, try this -

$("table#depart_me a.farebreakup").text()

As per Šime Vidas's comment below, the following selector would be more efficient -

$('a.farebreakup','#depart_me').text()

Demo - http://jsfiddle.net/wdwB3/

Upvotes: 0

Eric Di Bari
Eric Di Bari

Reputation: 3867

$("#depart_me").find("a.farebreakup").text();

Upvotes: 1

Related Questions