How to grab string from a HTML document using Javascript -
i trying grab string html page. string lives inside div tag no id, , has ever changing title property.
it looks this:
<div title = [this title changes depending on how page pulled up]> emailaddress abc@xyz </div>
i want able grab "abc@xyz" out of whole mess.
this html document ever changing, thing know sure stays same string want grab preceded "emailaddress"
i've been staring @ 3 hours no progress. i'd thankful if can point me in right direction.
without jquery:
var divelements = document.getelementsbytagname( 'div' ); ( var = 0; < divelements.length; i++ ) { if ( divelements[i].innertext.match( 'emailaddress' ) ) { // div var mail_id = divelements[i].innertext.replace('emailaddress ',''); } }
Comments
Post a Comment