Materialize CSS Select not Closing after selecting element

Naitik Kundalia

I am using materialize css. I created a tab and put select element inside it. But it was not closing after selecting element.I am using materialize 0.98.

If i put it outside tab then it works.

Here is my code :

My Scrtipt

<script>
        $(document).ready(function(e) {
            $('ul.tabs').tabs({'swipeable': true});
            $("select").material_select();
        });
    </script>

Html Code :

<div class="main mainContentMargin">
            <div class="row">
                <!-- This will Work-->
                <div class="col s12 input-field">
                    <select id="company_select1" name="company_select1">
                        <option value="-1" selected>Select Company</option>
                        <option value="1">1</option>
                        <option value="2">2</option>
                    </select>
                    <label>Select Company</label>
                </div>
            </div>
            <div class="row">
                <div class="card col s12 medium">
                    <ul id="tabs-swipe-demo" class="tabs tabs-fixed-width" style="margin-bottom: 1%">
                        <li class="tab col s6"><a href="#test-swipe-1">To Supplier</a></li>
                        <li class="tab col s6"><a href="#test-swipe-2">Using Product</a></li>
                    </ul>
                    <div id="test-swipe-1" class="col s12">
                        <!-- This will Work but not closing the dropdown-->
                        <div class="row">
                            <div class="col s12 input-field">
                                <select id="company_select" name="company_select">
                                    <option value="-1" selected>Select Company</option>                                                                                 
                                            <option value="1">1</option>
                                            <option value="2">2</option>
                                </select>
                                <label>Select Company</label>
                            </div>
                        </div>
                    </div>
                    <div id="test-swipe-2" class="col s12">

                    </div>
                </div>
            </div>
        </div>
Naitik Kundalia

Dropdown is not closing because we make tab swipeable. That's why it dropdown click event was catched by the tab.

I just set the stopPropogation option to true in dropdown and it work

$(document).ready(function(e) {
    $('ul.tabs').tabs({'swipeable': true});
    $("select").material_select({"stopPropagation":true});
});

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Materialize Css : select in card

From Dev

Materialize Css : select in card

From Dev

materialize css select is not working properly

From Dev

Materialize CSS select statement not showing

From Dev

Materialize CSS Select update error

From Dev

swift image picker not closing after selecting an image

From Dev

Closing listview after selecting an item - Jquery Mobile

From Dev

Re-init Materialize.css select box after removal from Knockout.js options array

From Dev

Materialize css - dynamically load tabs element

From Dev

Materialize css - dynamically load tabs element

From Java

Materialize CSS - Select Doesn't Seem to Render

From Dev

How to dynamically modify <select> in materialize css framework

From Dev

Materialize css select not working with JS errors

From Dev

jQuery selecting element AFTER the closest

From Dev

select child element without selecting parent element

From Dev

Bootstrap date picker after selecting date not closing picker

From Dev

How to select a group of elements after every nth-element in CSS?

From Dev

How do I select the next item after a target element in css?

From Dev

CSS :after content below a select element causes click not to work

From Dev

CSS select all elements of the same type after this element

From Dev

Materialize.css remove styling from input element

From Dev

ngModel not selecting proper option for select element

From Dev

Materialize CSS - Select does not have name nor proper value in DOM

From Dev

Multiple select option text standing under the checkbox in materialize.css

From Dev

Select option in drop down list materialize css In selenium using java

From Dev

Select dropdown list not closing after selection

From Dev

Jquery Selecting Previous Element After Click

From Dev

Select objects after selecting a div and an index

From Dev

Selecting specific tr element in a table (CSS)

Related Related

  1. 1

    Materialize Css : select in card

  2. 2

    Materialize Css : select in card

  3. 3

    materialize css select is not working properly

  4. 4

    Materialize CSS select statement not showing

  5. 5

    Materialize CSS Select update error

  6. 6

    swift image picker not closing after selecting an image

  7. 7

    Closing listview after selecting an item - Jquery Mobile

  8. 8

    Re-init Materialize.css select box after removal from Knockout.js options array

  9. 9

    Materialize css - dynamically load tabs element

  10. 10

    Materialize css - dynamically load tabs element

  11. 11

    Materialize CSS - Select Doesn't Seem to Render

  12. 12

    How to dynamically modify <select> in materialize css framework

  13. 13

    Materialize css select not working with JS errors

  14. 14

    jQuery selecting element AFTER the closest

  15. 15

    select child element without selecting parent element

  16. 16

    Bootstrap date picker after selecting date not closing picker

  17. 17

    How to select a group of elements after every nth-element in CSS?

  18. 18

    How do I select the next item after a target element in css?

  19. 19

    CSS :after content below a select element causes click not to work

  20. 20

    CSS select all elements of the same type after this element

  21. 21

    Materialize.css remove styling from input element

  22. 22

    ngModel not selecting proper option for select element

  23. 23

    Materialize CSS - Select does not have name nor proper value in DOM

  24. 24

    Multiple select option text standing under the checkbox in materialize.css

  25. 25

    Select option in drop down list materialize css In selenium using java

  26. 26

    Select dropdown list not closing after selection

  27. 27

    Jquery Selecting Previous Element After Click

  28. 28

    Select objects after selecting a div and an index

  29. 29

    Selecting specific tr element in a table (CSS)

HotTag

Archive