I want to disable my button on click and then reenable in after 5 seconds but its not working properly.
function submitPoll(id){
document.getElementB
Like Zee said .delay
is a JQuery function which can only be used on a JQuery object. Currently you are only using a reference to an HTML element which is produced by .getElementById()
If you are wanting a button that disables itself. I went ahead and made a little example on jsfiddle.
http://jsfiddle.net/1z0bx0t7/
Using code that looks like:
function submitPoll() {
document.getElementById("votebutton").disabled = true;
setTimeout(function() {
document.getElementById("votebutton").disabled = false;
}, 5000);
}
document.getElementById("votebutton").addEventListener("click", submitPoll);