简体   繁体   English

使下拉选项将您带到外部链接?

[英]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.我已经做了下拉菜单,但我不知道将代码放在哪里可以让您将 go 放到网站上。

 $(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.您需要将<a>标记中的#替换为您要定向到的页面的实际网址。 Also, your html doesn't seem correct.此外,您的 html 似乎不正确。 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>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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