Javascript delete div text from string -


i have string contains 2 div in text , settings. example :

<div class="a" id="b">blabla </div><div class="a">here text need </div> 

i need pull out text string, cant use sub string cause text dynamic , not written same. thanks

var str = '<div class="a" id="b">blabla </div><div class="a">here text need </div>'; var tmp = document.createelement('div'); tmp.innerhtml = str; console.log(tmp.innertext || tmp.textcontent);  // want? 

Comments