Javascript examples for jQuery:Form Button
Create one single html button to control play and pause
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript" src="https://code.jquery.com/jquery-compat-git.js"></script> <script type="text/javascript"> $(window).on('load', function() { var play = true;//w w w . j a v a2 s. co m $("button").click(function(){ if (play){ console.log("play"); play = false; } else { console.log("pause"); play = true; } }); }); </script> </head> <body> <button>Button</button> </body> </html>