I have two buttons like this:
<button class="medium" id="register" type="button"
onclick="location.href='/Account/Register'">Register</button>
<button class="medium default" id="login" type="submit">Login</button>
My Javascript selects the button by id:
<script type="text/javascript">
(function () {
document.getElementsByClassName('form')[0]
.addEventListener("submit", function (ev) {
document.getElementById('login').innerHTML += ' <i class="fa fa-spin fa-spinner" data-ng-show="fetching.length > 0"></i>';
}, false);
})();
</script>
How can I change this so the javascripts selects the button with a type of "submit" or a button with a class of "submit" if that's not possible?
Note that I would like to do this because the javascript is used by many forms. I need a common way to find the "submit" button.