Extracting anchor text from anchor tag with JavaScript -


i posted on question extracting anchor text anchor tag using javascript. got 1 answer it.

however code working in ie , chrome not in firefox.

function extracttext(){     var docid = "10";     var cid = "13";     var dname = "aspirin/coumarin";     var anchtext = "<a target=\"_blank\" href=hello?docid=" + docid + "&cid=" + cid +">" + dname +"</a>";     var str1 = document.createelement('str1');            str1.innerhtml = anchtext;     var anc = str1.innertext;      alert(anc);      return anc; } 

i suppose property of innertext or innerhtml or both not working in firefox. can please above code work ie, chrome, firefox etc.

textcontent w3c standard used in firefox alternative innertext


Comments