The hack is realted to the
window object of browser.
Some HTML element of webpage are available in window object. Let's understand with example
<h1 id="title"> This is title </h1>
var ele = document.getElementById('title'); ele.innerHTML = " This is modified Title";
If I say you that you can access the the above HTML element without doing
document.getElementById('title'). Some of you might say using jQuery and some of you might say not possible and some might be knowing the hack also.
I will not be using the jQuery. I am going to use the
window object to get the element.
alternative of getElementById?
This is the alternative of getElementById
window.title.innerHTML = " This is modified Title";
Every HTML element which has id attributes is available in the window object.
If you leaned then please do share and tweet about this.