Advertisement

Responsive Advertisement

Contoh penggunaan Select2

<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<link rel="stylesheet" href="{{ asset('css/select2.min.css') }}" />
</head>
<div class="form-group">
<select id="kota" name="kota" class="form-control">
<option value=""></option>
<option value="Jakarta">Jakarta</option>
<option value="Bogor">Bogor</option>

</select>
</div>

<body>

<script src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
<script src="{{ asset('js/select2.min.js') }}"></script>
<script>
$(document).ready(function() {
$("#kota").select2({
placeholder: "Please Select"
});

// $("#kota2").select2({
// placeholder: "Please Select"
// });
});
</script>
</body>

</html>

Document

Posting Komentar

0 Komentar