Reputation: 75217
I have a table like that:
<tr style="color: green;" id="bankRecord377">
<td align="center"> <input type="checkbox" value="377" name="377"></td>
<td align="center" id="started">19.25 USD</td>
<td align="center">392</td>
</tr>
How can I get 19.25 TL and then get 19.25 from there? (I can add id for that td too)
EDIT: I made a mistake while asking question and edited it.
Upvotes: 0
Views: 233
Reputation: 51
var td = document.getElementById('bankRecord377').getElementsByTagName('td')[1];
var value = td.innerHTML.split(" ")[0]; // 19.0
var value2 = parseInt(value); // 19
Upvotes: 0
Reputation: 5043
If I understand you correctly, you want the currency part (the center TD) from the row, right?
If you can give the TD with the name "started" an ID of "started", an easy solution using jQuery might be:
var currency1 = $("td#started").html(); // gets 19.25 USD
var currency2 = parseFloat(currency1.split(" ")[0]); // gets 19.25
Upvotes: 2
Reputation: 209
var currency = parseInt($('td[name=started]', '#bankRecord377').text().replace('USD', ''));
Upvotes: 0
Reputation: 75629
var tdContent = $('#bankRecord377 td[name=started]').html();
// or var tdContent = $('#idOfTd').html();
var number = +tdContent.replace(/[^0-9.]/g, '');
Upvotes: 2