BS3 Dropdown Widget

This is a simple Twitter Bootstrap 3 template. You can fork it to get a ready to use Bootstrap 3 fiddle.

by acjackson911

HTML

<script src="//netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css">
<div class="dropdown">
    <button id="dLabel" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
        Choose Option
        <span class="caret"></span>
    </button>
    
    <ul class="dropdown-menu" role="menu" aria-labelledby="dLabel">
        <li role="presentation" class="dropdown">
            <a role="menuitem" tabindex="-1" href="#" onclick="document.getElementById('selectedItem').innerHTML = this.innerHTML">
                Much much much longer text not fitting when resizing
            </a>
        </li>
        <li role="presentation" class="dropdown">
            <a role="menuitem" tabindex="-1" href="#" onclick="document.getElementById('selectedItem').innerHTML = this.innerHTML">
                Smaller text
            </a>
        </li>
    </ul>
</div>


selected: <div id="selectedItem"></div>

CSS

/* Latest compiled and minified CSS included as External Resource*/

/* Optional theme */
@import url('//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap-theme.min.css');

body {
    margin: 10px;
}

JavaScript

/* Latest compiled and minified JavaScript included as External Resource */