On a website I have a button that is either "Log in" or "Log out" shown below
<button id="userLogBtn" class="user-log-in-log-out-2" data-wf-user-logout="Log out" data-wf-user-login="Log in" type="button">Log out</button>
The type="button" is either >Log out< or >Log in<.
How do I read the HTML to see if it is Log out
So far using something like this is not working
if (document.getElementById('userLogBtn').innerHTML.indexOf(">Log in<") = -1)
>Log out<for example. - Andy=is for assignment, setting the value of something. You should be getting an error for the assignment shown, since you can't assign to the result of a function call. If you used==or===, the the condition would be true if the button did not have the text">Log in<"in it. 2. And indeed, it won't, because it looks like your button's text is"Log in"(no><) or"Log out". - T.J. Crowder