Return to Snippet

Revision: 70824
at July 26, 2016 01:05 by envane21


Initial Code
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>

Initial URL

                                

Initial Description
Switch between text on button every second

Initial Title
Switch between text on button every second

Initial Tags
text, button

Initial Language
jQuery