Or you can do it, like it ...
Using (documemt) .on seems to work more consistently than targeting the click event from the element class. In addition, by providing a button element, the identifier helps with the assignment of your choice in this case.
$(document).on('click', '.dropdown-menu li a', function () { var selText = $(this).text(); $('#dLabel').html(selText + '<span class="caret"</span>'); }); <div class="dropdown"> <button type="button" class="btn btn-primary dropdown-toggle" id="dLabel" role="button" data-toggle="dropdown" data-target="#"> Lists <span class="caret"></span> </button> <ul id="drpdn_List" runat="server" class="dropdown-menu" role="menu" aria-labelledby="dropdownmenu"> </ul> </div>
source share