根據所選選項,隱藏並顯示div。長話短說。隱藏並顯示jquery - 不工作但用小提琴工作正常
- 1級和2 - 隱藏的div名爲 「custompanel」
- 定製 - 顯示DIV命名爲 「custompanel」
正常工作與 JSFIDDLE 但我想這個問題將與CDN的。無法弄清楚。需要幫忙。
HTML
<head>
<meta charset="utf-8">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<title>Password Generator</title>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<!-- Optional theme -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous">
<!-- Latest compiled and minified JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="screen.css" media="screen, projection" />
<script>
$(document).ready(function() {
$('#generator-mixcase').on('change',function(){
if($(this).val() == 'custom') {
$('.custompanel').show();
} else {
$('.custompanel').hide();
}
});
});
</script>
</head>
異常顯示了在jquery的CDN錯誤。我的jQuery的CDN錯了嗎?
"Error: Failed to execute 'querySelectorAll' on 'Element': '*,:x' is not a valid selector.↵
at Error (native)↵ at https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js:2:10694↵
at ia (https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js:2:7550)↵
at fa.setDocument (https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js:2:10432)↵
at https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js:2:22250↵
at https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js:2:22970↵
at https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js:2:207↵
at https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js:2:212"
剛剛在本地進行了測試,至今沒有問題:http://pastebin.com/Wv029pEV嘗試檢查控制檯是否有錯誤。 – yuriy636
在它的破碎版本中,顯示 - 或隱藏面板不工作? – Sam0
運行代碼時是否存在這些元素?或者他們被插入後?控制檯中的任何錯誤?沒有太多的工作在這裏 – charlietfl