How do I make this into one button that toggles play/stop? $('.play').click(function() { $('#jquery-video').get(0).play(); }); $('.stop').click(function() { $('#jquery-video').get(0).pause(); }); $('.toggle').click(function() { if ($(this).hasClass('stopped')) { console.log("stopped"); $(this).removeClass("stopped"); $(this).addClass("playing"); } else { console.log("playing"); $(this).removeClass("playing"); $(this).addClass("stopped"); } }); </script> Code (markup):
Just have a variable that is equal to 1 or 0 that you check Check to see what the class is, if it is "playing" change it to "stopped" else change to "playing"
Check out these examples, see if you can apply some / any / all of it to your code: HTML5 - https://jsfiddle.net/tommy6s/rbnrfaht/ HTML5 - http://fiddle.jshell.net/q9uwtdee/6/ YouTube - http://jsfiddle.net/8kN6Z/1025/