jquery - Two function and alert not working? -
html code
<body> <h1 align="center">are ready?</h1> <h2 align="center">just answer yes or no!</h2> <div class="wrapper"> <button id="ohyes" class="buttonyes"> yes </button> <button id="ohno" class="buttonno"> no </button> </div> </body>
jquery code
<script> $(function () { $("#ohno").on({ mouseover: function () { $(this).css({ left: (math.random() * 800) + "px", right: (math.random() * 800) + "px", top: (math.random() * 400) + "px", }); } }); $("#ohyes").click(function () { alert("yes"); //use .val() if you're getting value }); }); </script>
i'm trying call function in jquery first working fine button moving on mouseover when click button having id ohyes isn't showing alert box? suggestions?
try : alert on second button ohyes
on click event.
$(document).ready(function(){ $("#ohno").mouseover(function(){ $(this).css({ left:(math.random()*800)+"px", right:(math.random()*800)+"px", top:(math.random()*400)+"px", }); }); $("#ohyes").click(function(){ alert("yes"); //use .val() if you're getting value }); });
Comments
Post a Comment