Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <title>Q Library</title>
- </head>
- <body>
- <div class="wrapper">
- <h1>This is a headline</h1>
- </div>
- <div class="wrapper2">
- <h1>This is second headline</h1>
- </div>
- <ul>
- <li>1 position</li>
- <li id="foo">2 position</li>
- <li>3 position</li>
- </ul>
- </body>
- <script type="text/javascript" src="Q.js"></script>
- <script type="text/javascript">
- (function ($) {
- $.fn.red = function() {
- var len = this.length;
- while (len--) {
- this[len].style.color = 'red';
- }
- return this;
- };
- })(Q);
- </script>
- <script type="text/javascript">
- (function ($) {
- $('.wrapper, .wrapper2').red();
- $('ul li').each(function(el) {
- console.log(el.innerHTML);
- });
- $('a').on('click', function(){
- alert('123');
- });
- })(Q);
- </script>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement