I'm using a Bootstrap multiselect plugin (
EDIT: This was fixed by using $('.example').multiselect();
CodePudding user response:
This code is working perfectly.
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css">
<script type="text/javascript" src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-multiselect/0.9.13/js/bootstrap-multiselect.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-multiselect/0.9.13/css/bootstrap-multiselect.css">
<?php
for($i = 0; $i < 7; $i ) {
$date=date("Y-m-d");
?>
<div >
<strong>Select Language:</strong>
<select id="ms-<?php echo $i?>-<?php echo $date; ?>" multiple="multiple">
<option value="php">PHP</option>
<option value="javascript">JavaScript</option>
<option value="java">Java</option>
<option value="sql">SQL</option>
<option value="jquery">Jquery</option>
<option value=".net">.Net</option>
</select>
</div>
<script>
$(document).ready(function() {
var i = '<?php echo $i; ?>';
var current_date = '<?php echo (string) $date; ?>';
$(`#ms-${i}-${current_date}`).multiselect({
includeSelectAllOption: true,
});
});
</script>
<?php
}
?>