【发布时间】:2012-07-12 18:29:22
【问题描述】:
我想使用select 元素在移动设备上查看我的网站。以下是select 选项。
HTML:
<select name="select-choice-8" id="select-choice-nc">
<optgroup label="News">
<option value="feature">Fea</option>
<option value="current">Current</option>
<option value="research">Research</option>
</optgroup>
<optgroup label="Archive">
<option value="archive">Archive</option>
</optgroup>
<optgroup label="Video">
<option value="">Video</option>
</optgroup>
<optgroup label="Submit">
<option value="">Story</option>
<option value="">Event</option>
</optgroup>
</select>
我想使用 JavaScript / jQuery 根据用户选择的内容执行一些 AJAX 调用,以避免重新加载整个页面(例如,用返回的 AJAX 内容填充容器)。
我需要一些想法或例子来解决这个问题。
提前致谢。
【问题讨论】:
-
没有人会为您编写代码。查看一些 jQuery tutorials and read through the documentation 并在遇到特定问题或问题时回来。
-
究竟是什么问题?我在您的帖子中没有看到任何问题。
-
我只是想让想法开始。你能指定我查看jquery网站的确切位置吗?
-
@jmoerdyk - 我有包含不同新闻文章的索引页面,并且使用 optgroup 我想通过单击特定选项来显示特定文章。
-
他只是想在选择一个选项时插入 html(使用 AJAX)(@ak1481 在你的帖子中写这个)。
标签: javascript jquery html ajax optgroup