Advertisement
Guest User

Untitled

a guest
Sep 5th, 2015
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>Q Library</title>
  5. </head>
  6. <body>
  7. <div class="wrapper">
  8. <h1>This is a headline</h1>
  9. </div>
  10. <div class="wrapper2">
  11. <h1>This is second headline</h1>
  12. </div>
  13.  
  14. <ul>
  15. <li>1 position</li>
  16. <li id="foo">2 position</li>
  17. <li>3 position</li>
  18. </ul>
  19. </body>
  20. <script type="text/javascript" src="Q.js"></script>
  21. <script type="text/javascript">
  22. (function ($) {
  23. $.fn.red = function() {
  24. var len = this.length;
  25.  
  26. while (len--) {
  27. this[len].style.color = 'red';
  28. }
  29.  
  30. return this;
  31. };
  32. })(Q);
  33. </script>
  34. <script type="text/javascript">
  35. (function ($) {
  36. $('.wrapper, .wrapper2').red();
  37.  
  38. $('ul li').each(function(el) {
  39. console.log(el.innerHTML);
  40. });
  41.  
  42. $('a').on('click', function(){
  43. alert('123');
  44. });
  45. })(Q);
  46. </script>
  47. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement