outerTEXT = Mar 10 (100) Apr 10 (100) May 10 (100) Jun 10 (100) Jun 10 (100)
innerHTML = <OPTION value=1 selected>Mar 10 (100)</OPTION> <OPTION value=2>Apr 10 (100)</OPTION> <OPTION value=3>May 10 (100)</OPTION> <OPTION value=4>Jun 10 (100)</OPTION> <OPTION value=5>Jun 10 (100)</OPTION>
outerHTML = <SELECT> <OPTION value=1 selected>Mar 10 (100)</OPTION> <OPTION value=2>Apr 10 (100)</OPTION> <OPTION value=3>May 10 (100)</OPTION> <OPTION value=4>Jun 10 (100)</OPTION> <OPTION value=5>Jun 10 (100)</OPTION></SELECT>
As you can see grab text will not help as there is no selected text, just all the text..
That is why I think the only way is to figure out what RegEx is needed to jerk out the "May 10 (100)" which is pointed to by the selected item.. 3
Both the innerHTML and outer HTML has the selection pointer but the basic content does not mark the selected one.
That is why I may have to take the value=1 and use split on the innerTEXT and count down to the third one in Javascript... but I was hoping someone could mod my REGEX above to pull out that simple little ""May 10 (100)" base on the select statment pointing to it..
Going with regex is horrible approach because there's so many gotchas. What do you mean "there's no selected text"? I don't have time now to try with code but I did multi-option select (which I didn't the last time which explains why I got the text with textContent), and when I look at the DOM, there's a DOM value "selected" in select element's children which gives false or true. So you could grab the select and loop thru all children looking for children where selected is true and then extract text value?
I'm not trying to be pick fun of you but are you familiar with DOM traversing or do you just know that there's a thing called DOM? For a long time I didn't understand what DOM really was and how it works. Because when it comes to value extraction, DOM is much better than regex but it's also harder to understand unless you play with javascript a lot. Javascript kinda forces you to learn what DOM really is and how it works. Nowadays I don't use regex at all when scraping, DOM gives me everything faster and easier. If you can see it in your browser, you can find it in DOM.