I need to extract a particular value from a html page -- the related html content is as below:
-html --
<table border=0 cellspacing='1' cellpadding='0' class="content-denote" width="965" >
<tr height=17><td align=left class="text21"><b>Sensex : 26326.60
[22.40]
<img src="../images/arow_green.jpg" width="14" height="12">
Nifty : 7970.05 [14.60]
<img src="../images/arow_green.jpg" width="14" height="12">
-- end of html --
The value I need to extract is the value that appears after "Nifty : " - in the above example '7970.05'.
I have the following code to extract this:
--code--
$('td.text21').each(function () {
status = true;
var price1 = $(this).text().substr(340,7);
--end of code --
however at times I have noticed that the place of the value is not 340 - it changes sometimes to 303 because the img src link changes depending on some values.
The value will always be after "Nifty : " - this never changes.
Is there a way where I can code to extract the 7 digit value that appears after "Nifty : "?
Any help will be appreciated.