vendredi 7 octobre 2016

jQuery if document title indexof matches string

So basically if document caption matches exactly, do something.

I am trying with indexOf but it keeps going on no matter what is the page title.

For example, on this very page, I want it to go on only when document caption is if statement - jQuery if document title indexof matches string - Stack Overflow (which it is now):

if (document.title.indexOf("if statement - jQuery if document title indexof matches string - Stack Overflow") === -1){
    alert("Hello! I am an alert box!!");
}

Aucun commentaire:

Enregistrer un commentaire