Advertisement
Guest User

Untitled

a guest
Apr 24th, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.15 KB | None | 0 0
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2.  
  3. <html xmlns="http://www.w3.org/1999/xhtml">
  4. <head>
  5. <title>Binding and Unbinding Events with jQuery</title>
  6. <script type="text/javascript" src="jquery-3.3.1.min-2.js"></script>
  7. <script type="text/javascript">
  8. $(function() {
  9. $("#evtTarget").mouseover(function(){
  10. $("#evtTarget").toggle("highlight");
  11. });
  12.  
  13. $("#evtTarget").mouseleave(function(){
  14. $("#evtTarget").toggle("highlight");
  15. });
  16.  
  17. });
  18. </script>
  19. <style type='text/css'>
  20. .normal {
  21. width:300px;
  22. height:200px;
  23. background-color:Yellow;
  24. font-size:18pt;
  25. }
  26.  
  27. .highlighted {
  28. background-color:Red;
  29. width:300px;
  30. height:200px;
  31. font-size:18pt;
  32.  
  33. }
  34. </style>
  35. </head>
  36. <body>
  37. <h1>Binding Event Example</h1>
  38. <div id="evtTarget" class="normal">Mouse over this div to see the effect. Click on it to unbind the mouseover.</div>
  39. </body>
  40. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement