jeudi 27 décembre 2018

Dropdown menu + PHP & JavaScript

I have this dropdown menu in bootstrap:

<div class="col-md dropdown">
    <button class="btn btn-secondary dropdown-toggle col-md" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
        SELECT AN APPLIANCE
    </button>
    <div class="dropdown-menu col-md" aria-labelledby="dropdownMenuButton">
        <a class="dropdown-item">Fridge</a>
        <a class="dropdown-item">Stove</a>
        <a class="dropdown-item">Oven</a>
        <a class="dropdown-item">Washer</a>
        <a class="dropdown-item">Dryer</a>
        <a class="dropdown-item">Dishwasher</a>
    </div>
</div>

What I need to achieve:

  • when a user select one element from the list the selected element appears instead of "SELECT AN APPLIANCE" using Jaavascript

  • get the selected element text and put it in a string using PHP




Aucun commentaire:

Enregistrer un commentaire