标签: asmselect

jQuery从select选项中切换div

我需要从下拉选择框中切换div.我喜欢它类似于jquery的asmselect,但不是列出选项标签我想它显示一个隐藏的div.那里有这样的东西吗?或者任何人都知道如何设置它?谢谢,杰夫.

更新

基本上我想要的是上面的asmselect链接的外观和交互,虽然切换div而不是生成列表.示例代码如下:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 

"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script type="text/javascript" src="jQuery1.3.js"></script>
<script type="text/javascript">

$(document).ready(function(){

    $("#theSelect").change(function(){          
        $("#theSelect option:selected").click(function(){
            var value = $(this).val();
            var theDiv = $(".is" + value);

            $(theDiv).toggle(function(){
                $(this).removeClass("hidden");
            }),function(){
                $(this).addClass("hidden");
            }
        }); 
    });

});

</script>
<style type="text/css">
.hidden {
    display: none;
}
</style>
</head>

<body>
    <div class="selectContainer">
        <select id="theSelect">
            <option value="">- Select -</option>
            <option value="Patient">Patient</option>
            <option value="Physician">Physician</option>
            <option value="Nurse">Nurse</option>
        </select>
    </div>
    <div class="hidden isPatient">Patient</div> …
Run Code Online (Sandbox Code Playgroud)

jquery html-select toggle asmselect

4
推荐指数
1
解决办法
3万
查看次数

标签 统计

asmselect ×1

html-select ×1

jquery ×1

toggle ×1