【发布时间】:2013-01-22 03:32:31
【问题描述】:
假设我有以下链接和下拉列表:
<a href="#contact">Send a mail to mother!</a>
<a href="#contact">Send a mail to father!</a>
<a href="#contact">Send a mail to sister!</a>
<a href="#contact">Send a mail to brother!</a>
<form id="contact">
<select id="recipient">
<option value="mother@mail.com">Mother</option>
<option value="father@mail.com">Father</option>
<option value="sister@mail.com">Sister</option>
<option value="brother@mail.com">Brother</option>
</select>
</form>
基本上我希望每个链接都更改为各自的选择选项。
为了给你一个上下文,现在我在页面末尾有一个表单,一开始我有几个电子邮件链接。当有人单击链接时,它将滚动(锚定)到表单。该表单具有此下拉菜单以选择收件人。我希望它不仅可以滚动到表单(已经完成),还可以根据点击的链接自动更改选项。
我怎样才能做到这一点?
【问题讨论】:
标签: javascript jquery select drop-down-menu