get multiple count selected

114
January 23, 2020, at 1:50 PM

I need to count teacher_id selected.

my input:

<select class="js-example-basic-multiple" name="teacher_school_id[]" id="teacher_school_id" multiple="multiple" style="width: 100%;">
<?php foreach($teachers as $teacher){
?>
<option value="<?php echo $teacher->teacher_id; ?>"><?php echo $teacher->teacher_name; ?></option><?php  } ?></select>

div:

<div id="test">Here i need how many teachers are selected</div>

script for counting teachers:

$(document).ready(function () {
$('#test').html('How many teachers?: ' +0 + ' entries');
$('.js-example-basic-multiple').change(function () {
    var count = 0;
    $('.js-example-basic-multiple').each(function () {
        if($.trim($(this).val()).length > 0)
            count++;
    });
    $('#test').html('How many teachers?: ' +count + ' entries');
}) 

script for multiple selection:

$(document).ready(function() {
$('.js-example-basic-multiple').select2(); 

But still doesnt work. No count. No output displayed. Any suggestion? Thanks a lot.

READ ALSO
Flatlist not showing items as intended

Flatlist not showing items as intended

I want to display some items with a flatlist, when I tap on the item I want it to turn greenThe issue I having is that I tap on a couple of the item and then I search for a device, for example: 112

311
how to download multiple images from firestore storage in web [duplicate]

how to download multiple images from firestore storage in web [duplicate]

For webHey is there any possible to download url of files from firestore storage without providing the file name in the storage reference ? Like if we have to download and display all the images from a particular folder, is it must to know the names of all the files uploaded...

128
How to implement webpack&#39;s hashed css files into my index.php?

How to implement webpack's hashed css files into my index.php?

I set up a webpack configuration, that uses the MiniCssExtractPlugin to compile my css into a single file into my public folder

121
Return multiple values in JavaScript?

Return multiple values in JavaScript?

I am trying to return two values in JavaScriptIs that possible?

130