如何选择下拉列表并更改内容 - 我的内容是jquery手风琴?
我有手风琴中的工作和描述列表,但我想通过添加某种下拉列表或类似的东西来对这些工作进行分类。因此,当您选择一个类别(ex creative jobs)时,它仅显示该类别中的作业。必须能够支持jquery手风琴。
谢谢:)
答案 0 :(得分:1)
<select id="someid">
<option value="1">one</option>
<option value="2">two/option>
<option value="3">three</option>
<option value="4">four</option>
</select>
<p>change goes here and put it inside your accordion content tab</p>
脚本
$(document).ready(function(){
$('#someid').change(function(){
$('p').html($(this).text());
});
});
答案 1 :(得分:0)
在select元素中使用onchange =“”事件,或者让jQuery按元素id / class / name处理它,由你决定。如果我没弄错的话,它不会干扰手风琴的运作。
一个小例子:
**html**
<html><body><select id="theList" onchange="showId();"><option>opt1</option><option>opt2</option></select></body></html>
**js**
<script>function showId() { var list = getElementById("theList"); alert(list.options[selectedIndex].value); </script>
希望这能澄清我的意思。