/ Published in: jQuery

Switch between text on button every second
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
var timer = setInterval(switchText,1000); var st = 1; function switchText(){ if(st==1){ $('#button').text("Text2"); st=2; }else{ $('#button').text("Text1"); st=1; } } HTML <div id="button">Text1</div>
Comments
