简体   繁体   中英

Make dropdown option take you to external link?

I am trying to create a dropdown with the options taking you to external sites or in my case my website but another language.

I have already made the dropdown but I don't know where to put the code which will allow you to go to the site.

 $(document).ready(function() { $('button').click(function() { $('ul').toggleClass('active') }) })
 <script src="https://code.jquery.com/jquery-3.3.1.js"></script> <div> <button class="btn">Change Language</button> <a href="https://discord.com/oauth2/authorize?client_id=709030261605793803&permissions=171166800&scope=bot"> <button type="submit" class="btn">Invite To Discord</button> <a href=""> <button type="submit" class="btn">Get Started</button> <ul class="active"> <li><a href="#">Français</a></li> <li><a href="#">Português</a></li> <li><a href="#">русский (Russian)</a></li> </ul> </a> </a> </div>

You need to replace the # within your <a> tags with the actual urls of the page you want to direct to. Also, your html doesn't seem correct. Links within links, plus the addition of buttons all seems very confusing. Depending on what you are trying to do, try simplifying it to something like this...

<div>
  <ul>
    <li><a href="francais.html">Français</a></li>
    <li><a href="portugues.htm">Português</a></li>
    <li><a href="russian.html">русский (Russian)</a></li>
  </ul>
</div>

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