WasiF
WasiF

Reputation: 28847

Dropdown menu not showing its Items on Click in ASP.NET MVC5 View

When I click the dropdown menu, then it should show its items but it don't. I know not why this is happening. Kindly tell me where I should make the changes to improve it

ul+li dropdown-menu not showing its items

<div class="dropdown">
        <button class="btn dropdown-toggle" type="button" data-toggle="dropdown">
            Dropdown <span class="caret"></span>
        </button>
        <ul class="dropdown-menu" role="menu">
            <li role="presentation"><a href="#" role="menuitem" tabindex="-1">List Item 1</a></li>
            <li role="presentation"><a href="#" role="menuitem" tabindex="-1">List Item 1</a></li>
            <li role="presentation"><a href="#" role="menuitem" tabindex="-1">List Item 1</a></li>
            <li role="presentation"><a href="#" role="menuitem" tabindex="-1">List Item 1</a></li>
        </ul>
    </div>

Below given dropdown-menu is showing its items then how I can create Mega-dropdown menu with select and option tags. kindly guide me

<div class="dropdown" data-toggle="dropdown">
        <select name="colour" class="form-control">
            <option>Please Select</option>
            <option>red</option>
            <option>orange</option>
            <option>blue</option>
        </select>
    </div>

Upvotes: 0

Views: 1046

Answers (3)

WasiF
WasiF

Reputation: 28847

Can anyone modify it to create mega dropdown-menu, please add more information to it. Your cooperation will be appreciated :-)

<div class="dropdown" data-toggle="dropdown">
        <select name="Items" class="form-control">
            <optgroup label="Group 1">
                <option>Item 1</option>
                <option>Item 2</option>
                <option>Item 3</option>
                <option>Item 4</option>
            </optgroup>
            <optgroup label="Group 2">
                <option>Item 1</option>
                <option>Item 2</option>
                <option>Item 3</option>
                <option>Item 4</option>
            </optgroup>
            <option>Clothes</option>
            <option>Foods</option>
        </select>
    </div>

Upvotes: 0

user116829
user116829

Reputation: 56

Lists are basically used just to list the elements.

In order to make your dropdown list work, you can use select and option HTML tags instead of ul and li

Upvotes: 2

user116829
user116829

Reputation: 56

You can use optgroup tag for multi level dropdown list. Its easy to implement and you can get lots of articles to aid you.

Upvotes: 2

Related Questions