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.9.1.min.js"></script>
  
<script src="http://ivaynberg.github.io/select2/select2-3.4.5/select2.js?ts=2014-02-03T15%3A41%3A41-08%3A00"></script>  
  
      <link href="http://ivaynberg.github.io/select2/select2-3.4.5/select2.css?ts=2014-02-03T15%3A41%3A41-08%3A00" rel="stylesheet"/>
  
  <meta charset="utf-8">
  <title>JS Bin</title>
</head>
<body>
  
  
  <select data-plug="select2" data-plug-op='{"placeholder":"text1","containerCssClass":"style1"}'>
    <option></option>
     <option>1</option>
     <option>2</option>
</select>
<select data-plug="select2" data-plug-op='{"placeholder":"text2","containerCssClass":"style2","dropdownCssClass":"dropdowncss"}'>
    <option></option>
     <option>1</option>
     <option>2</option>
</select>
  
</body>
</html>
 
 $(document).ready(function() { 
   
var slc = $('[data-plug="select2"]');
assignSelect(slc);
function assignSelect(selectElement) {
    selectElement.each(function(){
        var $this  = $(this),
            plugOp = $.parseJSON( $this.attr('data-plug-op') );
        /*-- --*/
        $.each(plugOp,function(k,v){
            
           $.fn.select2.defaults.dropdownCssClass = v;
           $this.select2().data('placeholder', plugOp.placeholder).select2({
             k:v
            });
        });
        /*-- --*/
    });
}
 
 });
Output

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

Dismiss x
public
Bin info
holmes2136pro
0viewers