0

i did not understand how can i use AlloyUI dropdown script. i have write this code 5 time on my same page.

<div id="myDropdown" class="dropdown">
<button id="myTrigger" class="btn btn-default dropdown-toggle" type="button">
  Dropdown
 <span class="caret"></span>
  </button>
  <ul class="dropdown-menu">
    <li><a tabindex="-1" href="#">Action</a></li>
  </ul>
 </div>

in this html have same classes and id, and i use this script. i take this code from alloy. follow this http://alloyui.com/examples/dropdown/

YUI().use(
 'aui-dropdown',
  function(Y) {
  new Y.Dropdown(
  {
    boundingBox: '#myDropdown',
    trigger: '#myTrigger'
  }
).render();
 }
  );

i have 5 dropdown on my same page with same html code. when i run this code my first drop down is working and other is not working.

Loïc Gammaitoni
  • 4,173
  • 16
  • 39
  • this `YUI()` apply on first html of dropdown and its working but other dropdown is not working – Imran Amanat Aug 27 '15 at 20:24
  • You said the answer yourself. You have only applied the dropdown to the first HTML. For five dropdowns, you will need to do `new Y.Dropdown` five times. Make sure that your five dropdowns have different ids and then reference them in the `trigger` and `boundingBox` attributes. – stiemannkj1 Aug 31 '15 at 11:54

0 Answers0