Okay so I have the following variable...
var href = document.querySelector('a').getAttribute('href');
...and wish to use it to execute this:
window.onload = function(){
if (href = "example.html"){
/* do something */
}
I only use Vanilla Javascript so if there is a solution to the above, It's greatly appreciated if its not jQuery.
Thanks in advance!
EDIT: This question is different from "The 3 different equals" asked by Strawberry because its answers include jQuery, while this question is for only Vanilla JavaScript solutions. Additionally, this question is specific to utilizing href in the execution of a function, while the question asked by Strawberry rather generalizes the purpose of =, ==, and ===, and does not specifically address whether or not using such code would enable the use of href for executing a function - moreover, there is no mention of href in the question asked by Strawberry.