Mostafa Mohamed Mostafa Mohamed - 7 months ago 12
Javascript Question

setTimeout is undefiend why?

i want to disable a button click for a period of time before next click

like when i click it should wait 3 or 5 seconds before next ablity to click it again so i have this piece of code to do so but i don't know why it gives me an error says :

ReferenceError: setTimout is not defined


and the button click one and stop forever.

Here is my code

module.SynchNotificationWidget = module.StatusWidget.extend({
template: 'SynchNotificationWidget',
start: function(){
var self = this;
this.pos.bind('change:synch', function(pos,synch){
self.set_status(synch.state, synch.pending);
});
this.$el.click(function(){
setTimout(self.$el.attr("disabled", false), 1000);
self.pos.push_order();
});
},
});

Answer

You made a spelling mistake. It is setTimeout(self.$el.attr("disabled", false), 1000);