使用jquery时Div不会显示()
我遇到了一个非常棘手的问题。如果单击class:change\u btn,我想显示一个特定的div。但是唯一有效的是密码表单passwordFC。单击其他按钮时,什么都看不见。他们有内容。这怎么可能 我已经试了好几个小时了,非常感谢你的帮助 致意 吉米 Jquery Html使用jquery时Div不会显示(),jquery,class,html,hide,show,Jquery,Class,Html,Hide,Show,我遇到了一个非常棘手的问题。如果单击class:change\u btn,我想显示一个特定的div。但是唯一有效的是密码表单passwordFC。单击其他按钮时,什么都看不见。他们有内容。这怎么可能 我已经试了好几个小时了,非常感谢你的帮助 致意 吉米 Jquery Html 这是你需要做的。在测试过程中删除PHP内容- 这是你需要做的。在测试过程中删除PHP内容- 看起来它在工作。。。也许你包含的PHP代码破坏了东西?对我来说很好。你们说得对,我删除了php代码,现在一切正常。很奇怪,incl
这是你需要做的。在测试过程中删除PHP内容-
这是你需要做的。在测试过程中删除PHP内容-
看起来它在工作。。。也许你包含的PHP代码破坏了东西?对我来说很好。你们说得对,我删除了php代码,现在一切正常。很奇怪,include文档只有一个表单。我会调查的,谢谢!如果包含的代码包含无效的HTML,例如结束标记,则可能会导致意外行为。看起来它正在工作。。。也许你包含的PHP代码破坏了东西?对我来说很好。你们说得对,我删除了php代码,现在一切正常。很奇怪,include文档只有一个表单。我会调查的,谢谢!如果包含的代码包含无效的HTML,例如结束标记,则可能导致意外行为。OP发布的代码似乎工作正常,因此我不确定您在此处修复了什么。除了隐藏.passwordFC之外,我认为他们希望它可见,因为他们明确地使它可见。OP发布的代码似乎工作得很好,所以我不确定您在这里修复了什么。除了隐藏.passwordFC之外,我认为他们希望它可见,因为他们明确地使它可见。
jQuery(function($) {
/* Make the password form show first as standard */
$(".settingsFC").hide();
$(".passwordFC").show();
/* Function that shows the right form when clicking the buttons */
$(".change_btn").click(function() {
$choosenForm = "." + $(this).attr("title");
/* Remove the style on the other buttons */
$(".settingButton").css('background-color','#ebeaea');
$(".settingButton").css('font-weight','normal');
/* Add style to clicked button */
$(this).css('background-color','#e0e0e0');
$(this).css('font-weight','bold');
/* Hide the other containers, if i remove this they show when clicking. */
$(".settingsFC").hide();
/* Tried this one as well, didnt work */
//$(".settingsFC:not(."+$choosenForm+")").hide();
/* Show the right container */
$($choosenForm).show();
});
});
<div title="passwordFC" class="settingButton px10 change_btn firstSettingsChoice"> INLOGGNING </div>
<div title="personalFC" class="settingButton px10 change_btn"> PERSONLIGT </div>
<div title="paymentFC" class="settingButton px10 change_btn"> BETALNINGSPLAN </div>
<div title="cloudFC" class="settingButton px10 change_btn"> CLOUD INSTÄLLNINGAR </div>
<div class="settingsFC passwordFC">
<?php include("includes/changeSettings/changePassword.php"); ?>
</div> <!-- changePassword -->
<div class="settingsFC personalFC">
<?php include("includes/changeSettings/changePersonal.php"); ?>
</div> <!-- changePersonal -->
<div class="settingsFC paymentFC">
<?php include("includes/changeSettings/changePayment.php"); ?>
</div> <!-- changePayment -->
<div class="settingsFC cloudFC">
<?php include("includes/changeSettings/changeCloud.php"); ?>
</div> <!-- changeCloud -->
$(document).ready(function() {
/* Make the password form show first as standard */
$(".settingsFC").hide();
//$(".passwordFC").show();
/* Function that shows the right form when clicking the buttons */
$(".change_btn").click(function() {
var choosenForm = "." + $(this).attr("title");
/* Remove the style on the other buttons */
$(".settingButton").css('background-color','#ebeaea');
$(".settingButton").css('font-weight','normal');
/* Add style to clicked button */
$(this).css('background-color','#e0e0e0');
$(this).css('font-weight','bold');
/* Hide the other containers, if i remove this they show when clicking. */
$(".settingsFC").hide();
/* Tried this one as well, didnt work */
//$(".settingsFC:not(."+$choosenForm+")").hide();
/* Show the right container */
$(choosenForm).show();
});
});