behigh/bootstrap_dropdowns_enhancement

Dropdown events

Opened this issue · 1 comments

All dropdown events are not fired
show.bs.dropdown, shown.bs.dropdown, hide.bs.dropdown, hidden.bs.dropdown not work with this plugin.
$('#myDropdown').on('show.bs.dropdown', function () { // **NOT WORK** })

I had the same problem. But here is my workaround:

				<div class="btn-group">
		            <button data-toggle="dropdown" class="btn btn-default dropdown-toggle">
		            	<span data-label-placement="">Sort 2</span> <span class="caret"></span>
		            </button>
		            <ul id="myDropdown" class="dropdown-menu">
		              <li>
		                <input type="radio" id="ex4_1" name="ex4" value="1" checked="">
		                <label for="ex4_1">Sort 1</label>
		              </li>
		              <li>
		                <input type="radio" id="ex4_2" name="ex4" value="2" checked="checked">
		                <label for="ex4_2">Sort 2</label>
		              </li>
		              <li>
		                <input type="radio" id="ex4_3" name="ex4" value="3">
		                <label for="ex4_3">Sort 3</label>
		              </li>
		              <li>
		                <input type="radio" id="ex4_4" name="ex4" value="4">
		                <label for="ex4_4">Sort 4</label>
		              </li>
		            </ul>
		        </div>
				<script type="text/javascript">
					$('#myDropdown li').click(function(e){
						if ($(e.toElement).prop("tagName") == 'INPUT'){
							console.log('Name: '+$(this).children('label').html());
							console.log('Value: '+$(this).children('input').val());
						}
					});
				</script>