简体   繁体   中英

Change Tab using Dropdown menu

I have found the web page below with similar feature, but I am trying to use a dropdown menu instead of a button or A link.

https://jsfiddle.net/Aya_Salama/oyb8smdg/

I think the issue is here: onchange="$('#'+$this).trigger('click')"

<select class="form-control" onchange="$('#'+$this).trigger('click')">
          <option id="second_tab">Second</option>
          <option id="third_tab">Third</option>
</select>
<a class="btn btn-primary btn-lg" onclick="$('#second_tab').trigger('click')">Second</a>
<a class="btn btn-primary btn-lg" onclick="$('#third_tab').trigger('click')">Third</a>```

Figured it out.

<select onchange="$('#'+this.value).trigger('click')">
          <option value="second_tab">Second</option>
          <option value="third_tab">Third</option>
</select>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM