Home Select2 Placeholder not working
Reply: 0

Select2 Placeholder not working

user876
1#
user876 Published in April 21, 2018, 3:08 pm

I'm trying to use the Select2 multiple placeholder. And when I use it, its simply not working.

this is my JS code:

        $(".materialS").select2({
        placeholder: 'Material types'
    });

and the Html/Php code:

<select class="materialS" name="material[]" multiple="multiple">
                <?php if ($materials){
                    foreach ($materials as $material) { ?>
                    <option value="<?php echo safe_class($material)?>"><?php echo $material; ?></option>
                    <?php }} ?>
                </select> 

so I get the materials from db(more like wp). now the thing is that when I click on some select and then I remove it, I can see the placeholder but not before.

any idea whats wrong?

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.314108 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO