I got on my page inside a DIV with content editable on some text. In this text I need to get the value of all P
elements (text written by user) but I need to exclude all span elements (variables that are not used for the rest of the work I have to do).
I tried to do it using querySelector in IE11 but here is the deal : For IE11 querySelector doesn't exist, even when I spy the element and it tell me this method exist (using F12 and putting a spy on it). What should I do to correct that ? I tried something I found on this forum that's say to put :
<meta http-equiv="X-UA-Compatible" content="IE=11" />
in the Head of the document, but it did not work.
The JS I use to do this is :
function recupTXT(div) {
var textRecup = div.cloneNode(true);
while (textRecup.querySelector("span") !== null) {
textRecup.querySelector("span").parentNode.removeChild(textRecup.querySelector("span"));
}
return textRecup.innerText;
}
EDIT :
he is call like that :
var text = recupTXT(document.getElementById('edth_corps'));
where edth_corps is the content editable generated programmaticaly
If I try it on a stand alone, with the same condition (content editable and stuff), it work pretty fine and do what I need. But in my application it failed. So is it just a configuration issue ? or is there something I'm missing ?