Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
<script src="http://code.jquery.com/jquery-1.11.0.min.js"></script>
<script src="http://code.jquery.com/ui/1.10.4/jquery-ui.min.js"></script>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<title>Style Select Boxes Using jQuery + CSS</title>
<script type="text/javascript">
  
$(function(){
  var q = $('#i').messagePlugin()
  console.clear();
  console.log(q);
  q.css('color','gren');
  q.m_one("");
});
</script>
</head>
<body>
  <div>hallo</div>
  <div>hallo</div>
  <div>hallo</div>
  <div id='i'>daar</div>
  <p id=para>hola nmundo</p>
  
</body>
</html>
 
jQuery.fn.messagePlugin = function(){
    var selectedObjects = this;
  
    return {
             saySomething : function(message){
                              $(selectedObjects).each(function(){
                                $(this).html(message);
                              });
                              return selectedObjects; // Preserve the jQuery chainability 
                            },
             anotherAction : function(){
                               //...
                               return selectedObjects;
                             }
           };
};
// Usage:
var a = $('p').messagePlugin();
var the=20;
$('p').messagePlugin();
a.anotherAction(the).css('color', 'red');
var b = $('div').messagePlugin();
b.saySomething("the").css('color', 'red');
a.saySomething('I am a Paragraph').css('color', 'blue');
Output 300px

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

Dismiss x
public
Bin info
anonymouspro
0viewers