我有,我想只顯示,如果某個值從下拉菜單中選擇(在這種情況下,它是custom-css
)基於選擇框更改DIV的知名度
在小提琴(http://jsfiddle.net/obmerk99/8xnzh/1/)一個div它的工作原理確定...
jQuery(document).ready(function() {
jQuery("#k99-custom-1").change(function() {
jQuery("#k99-custom-1 option:selected").each(function()
{
if(jQuery(this).attr("value") == "custom-css")
{
jQuery("#customcss").show();
}
else
{
jQuery("#customcss").hide();
}
});
}).change();
});
,但在現實頁面,選擇下拉實際上是動態地「添加選項」按鈕生成的,因此某些(第一)選擇不存在的頁面加載(文件準備好了),我認爲這是它不起作用的原因..
在這裏看到完整的行動(不工作):http://jsfiddle.net/obmerk99/ZcAzy/1/
如果選擇「custom-css」值,我爲什麼要顯示div? (現在它被設置爲只與第一個(或第二個)一起工作 - 但是它可以很好地與所有添加的選擇列表配合使用。)
大聲笑,我在更新答案,當你選擇它,希望它可以幫助 – 2013-07-02 20:57:13