Ответы пользователя по тегу Bootstrap
  • Как заставить select2-bootstrap-css работать?

    @evolit Автор вопроса
    Вася
    В общем всё получилось:

    <!DOCTYPE html>
    <html>
    <head>
    	<title></title>
    	<script src="http://code.jquery.com/jquery-2.1.3.min.js"></script>
    	<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/js/bootstrap.min.js"></script>
    	<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css" rel="stylesheet">
    	<link href="https://cdnjs.cloudflare.com/ajax/libs/select2/3.5.2/select2.min.css" rel="stylesheet" />
    	<script src="https://cdnjs.cloudflare.com/ajax/libs/select2/3.5.2/select2.min.js"></script>
    	<link href="https://cdnjs.cloudflare.com/ajax/libs/select2-bootstrap-css/1.4.6/select2-bootstrap.min.css" rel="stylesheet" />
    	<script type="text/javascript">
    		$(document).ready(function(){
    				$( ".select2" ).select2( { placeholder: "Select a State"} );
    		});
    	</script>
    	
    </head>
    <body>
    <div class="col-md-4" style="margin:50px">
    <select class="form-control select2" >
    	<option></option>
    		<optgroup label="Alaskan/Hawaiian Time Zone">
    			<option value="AK">Alaska</option>
    			<option value="HI">Hawaii</option>
    		</optgroup>
    		<optgroup label="Pacific Time Zone">
    			<option value="CA">California</option>
    			<option value="NV">Nevada</option>
    			<option value="OR">Oregon</option>
    			<option value="WA">Washington</option>
    		</optgroup>
    		<optgroup label="Mountain Time Zone">
    			<option value="AZ">Arizona</option>
    			<option value="CO">Colorado</option>
    			<option value="ID">Idaho</option>
    			<option value="MT">Montana</option><option value="NE">Nebraska</option>
    			<option value="NM">New Mexico</option>
    			<option value="ND">North Dakota</option>
    			<option value="UT">Utah</option>
    			<option value="WY">Wyoming</option>
    		</optgroup>
    		<optgroup label="Central Time Zone">
    			<option value="AL">Alabama</option>
    			<option value="AR">Arkansas</option>
    			<option value="IL">Illinois</option>
    			<option value="IA">Iowa</option>
    			<option value="KS">Kansas</option>
    			<option value="KY">Kentucky</option>
    			<option value="LA">Louisiana</option>
    			<option value="MN">Minnesota</option>
    			<option value="MS">Mississippi</option>
    			<option value="MO">Missouri</option>
    		</optgroup>
    </select>
    
    </Div>
    
    </body>
    </html>
    Ответ написан
    2 комментария