Disable onclick

Disable button onclick

by Leandro Barbosa

HTML

<button type="button" class="btn" onclick="this.disabled=true; alert('this is the submitGoToAcct function...');">Submit button</button>

<a href="javascript:void(0)" class="btn" onclick="this.disabled=true; this.onclick=function(){return false;}; alert('this is the submitGoToAcct function...');">Submit link</a>

CSS

.btn {
    border: 0;
    margin: 10px;
    font-family: Helvetica, sans-serif;
    font-size: 16px;
    display: inline-block;
    text-decoration: none;
    text-transform: uppercase;
    padding: 5px 12px;
    border-radius: 4px;
    background: blue;
    color: white;
}

.btn:disabled {
    background: gray;
}