I have this js script:
<script>
var checking_for_user = <%- JSON.stringify(overwrite) %> ;
if (checking_for_user) {
console.log('I reached here.');
document.querySelector('.msg .text-center').innerHTML='User does not exist! Please go back to the <a href="/index">Index Page</a>';
}
</script>
And below the script, i have this HTML code:
<div class="msg">
<h1 class="text-center">
There was an error. Please go back to the <a href="/index">Index Page</a>
</h1>
</div>
The checking_for_user variable
is from a Node.js response.
The code manages to reach the console.log('I reached here.');
but the HTML doesn't change.
The document.querySelector()
line does not work.
I tried even simpler parameters to document.querySelector()
(just a string - no hyperlink) but it failed as well.
Anyone has a clue on what i am doing wrong here?