public
Description: plugins, examples, snippets
Homepage:
Clone URL: git://github.com/benatkin/jquery-stuff.git
jquery-stuff / convenience.html
100644 30 lines (27 sloc) 0.922 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<html>
<head>
  <title>convenience</title>
  <script type="text/javascript" src="jquery.js"></script>
  <script type="text/javascript" src="jquery.convenience.js"></script>
  <script type="text/javascript">
    $(function() {
      $.each(['red', 'green'], function() {
        var btn = $('<input>').attr({type: 'button', value: 'Frobnicate This!'}).addClass('frob');
        $('<div>').addClass(this).css({backgroundColor: this}).appendTo($('body')).append(btn);
      });
      $('div').css({width: '200px', height: '200px', padding: '20px', 'float': 'left'});
 
      $.convenience('frobnicate');
      $('.green').frobnicate(function() {
        if (console) console.log('frobbed!');
        $(this).css({border: '5px solid black'});
      });
      $('.frob').click(function() {
        if (console) console.log('clicked!');
        $(this).frobnicate();
      });
    });
  </script>
</head>
<body>
</body>
</html>