根据所选选项,隐藏并显示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