javascript change element from another page

Yes it can change the text.

Any event on most HTML elements can have their default action overridden.

Having the onclick event object you should use event.preventDefault() to cancel the default action.

An example:

document.getElementById("my-link-element").addEventListener("click", function(event) {
    event.preventDefault();
    // and here change the text ..
});

Leave a Comment