私は本当に奇妙な問題を抱えています。class:"change_btn" をクリックすると、特定の div を表示したい。しかし、機能しているのはパスワード形式 (passwordFC) だけです。他のボタンをクリックしても何も表示されません。それらにはコンテンツがあります。どうすればいいの?
私は何時間も試しましたが、どんな助けも大歓迎です。
よろしくジミー
Jクエリ
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();
});
});
HTML
<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 -->