Here comes a simple question, for all those who know javascript.
I made an application, which grabs the following code and puts it into a variable:
<div class="article-author">Af <span class="remove_from_bt_touch">:</span>Af Tho
mas Søgaard Rohde, Berlingske Nyhedsbureau<span class="section-time">&nbs
p;15. jan. 2012
|
</span>
<span class="section-category">Danmark</span>
</div>
Now, what I want is another variable, containing the DATE of the variable above. So it should be 15. jan. 2012.
How do I do that?
Don’t really understand what you mean by “puts it in a variable” other than to say the markup is a string assigned to a variable like:
If that is the case, you can get the date (provided it is exactly in the format shown) using match with a regular expression:
However, if you mean it is markup in a page and you are trying to get the text in the span with class section-time, then you can use something like:
Or you could get all such dates in an array using match with the above regular expression on the innerHTML of a common parent element.