Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>JS Bin</title>
</head>
<body>
<script src="https://code.jquery.com/jquery-2.2.4.js"></script>
  <div id="myElem">My element</div>
</body>
</html>
 
; (function ($, window, document, undefined) {
    var pluginName = 'searchAreaControl';
    function Plugin(element, options) {     
        this.el = element;
        this.$el = $(element);
        this.opt = options;
        this.init();
    }
  
    Plugin.prototype = {
      
      init: function() {
          this.$el.css('color',this.opt.color);
      }
      
    }
  
    $.fn[pluginName] = function (options) {
        return this.each(function() {
            new Plugin(this, options);
        });
    }
})(jQuery, window, document);
$(document).ready(() => {
  $('#myElem').searchAreaControl({ color: 'green' });
});
Output 300px

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
anonymouspro
0viewers