I would not have access to edit the HTML but would like to add a piece of JavaScript to a page so that it overwrites the default onClick behavior on a button.
This is the code, and I would like to use JS to take users to google.com after they click the "Enter" button. I would also prefer not to use the class, name or type to find this code, but will if that's the only option.
HTML:
<div class="button">
<input type="submit" name="cantUseName" value="Enter" onclick="if(isNew){ $(jQuery('[id$=Test]')[0]).show(); return false; } else return true;" class="main">
</div>
From what I gathered here, I created a JS that should technically do what I want. However, I cannot test this in fiddle because it removed the code in the URL for some reason, telling me that there is something wrong with the JS.
JS:
document.querySelectorAll("input[value=Enter]").onclick = function () {
location.href = "www.google.com";
};