I'm using multiple Bootstrap dropdown controls and need to
set a value to an input field when a list item of a specific dropdown is selected. For
example, say I have 3
dropdowns:
- ulSaukContact
- ulMoselContact
- ulShipContact
All
three are running on the server, and I need to get the value of each so I can save them
somewhere. So I figured I should probably save the value of each to a hidden input field
that I can reference later. Here is my attempted JS code for doing
this:
$("#ulSaukContact li
a").on("click", function () {
alert('sauk'); // <--- Alert is not
shown
var elem = document.getElementById("inpSaukValue");
elem.Value =
$(this).text();
});
and
the accompanying markup
class="dropdown">
style="width: 100%;">
Select a
Saukville contact
class="caret">
id="ulSaukContact" class="dropdown-menu" role="menu" aria-labelledby="dropdownMenu1"
runat="server" style="width: 100%">
type="hidden" />
No comments:
Post a Comment