javascript - How to update the dropdown-menu text after selected? -
i have dropdown-menu.
html
<div id="dd" class="wrapper-dropdown-1" tabindex="1"> <span class="summary-texts">summary</span> <ul class="dropdown"> <!-- dynamic list added here --> </ul> </div>
the list in there dynamically populate using js.
js
for (var assignment in objects.assignments ) { $("#dd .dropdown").append('<li><a class="group" id="group-'+assignment+'">group ' + assignment + '</a></li>'); //update text $("#dd .wrapper-dropdown-1 .summary-texts").text('group ' + assignment); }
i want change "summary" whatever group selected. i'm not sure "summary" keep displaying, after select other groups.
i hope willing give me little here.
any tips / helps appreciated.
two ways this, set selector correctly:
"#dd.wrapper-dropdown-1 .summary-texts"
(note, no space)
or set id on "summary" text:
<span id="summarytext" class="summary-texts">
and identify id.
Comments
Post a Comment