jeudi 21 décembre 2017

Keep checking If Div contains specific text

Hello So I want to keep checking a function and if a div contains a specific text here is what I have so far but it doesn't seem to be working any ideas?

JS

var interval = 500;
var timer = window.setInterval(function() {
    var text = $('.text-split-original').text();
    var checkText = '4) PLACEHOLDER '

    if(text == checkText){
        alert("It has this text");
        //do something
    };
}, interval);

HTML

<div class="sar__label">
    <div class="text-split-original">
        4) PLACEHOLDER 
        <br>
    </div>
</div>

Thanks in advance for any help.

Aucun commentaire:

Enregistrer un commentaire