How would I do this without jQuery?
$(\'input[type=submit]\').attr(\'disabled\',true);
It doesn\'t have to be cross-browser compatible; a s
Have you tried
document.getElementsByTagName("input");
then you could interrogate the DOM to find your submit button. getElementsByTagName reference
A full sample
window.onload = function(e) {
var forms = document.getElementsByTagName('form');
for (var i = 0; i < forms.length; i++) {
var input = forms[i].getElementsByTagName('input');
for (var y = 0; y < input.length; y++) {
if (input[y].type == 'submit') {
input[y].disabled = 'disabled';
}
}
}
}
This is untested, but it or something very similar should work. It could be made better with error and feature checking.
var inputs = document.getElementsByTagName('input');
for(var i = 0; i < inputs.length; i++){
if(inputs[i].type == 'submit'){
inputs[i].disabled = 'disabled';
}
}
var els = document.getElementsByTagName ( 'input' );
for ( var i = 0; i < els.length ; i ++ ) {
if ( els[i].type == 'submit' ) els[i].setAttribute('disabled', 'true');
}
var inputs = document.getElementsByTagName("INPUT");
for (var i = 0; i < inputs.length; i++) {
if (inputs[i].type === 'submit') {
inputs[i].disabled = true;
}
}