-1
裏面的類「我」裏面的「格」的,我有一個HTML如何更改目標元素
<div class="panel-heading" onclick="toggleMe('<?php echo $warehouse['country']; ?>1', '<?php echo $warehouse['country']; ?>')">
<span class="panel-title"> Warehouse Address <span><?php echo $warehouse['country']; ?></span>
<div class="panel-title-right"><i class="fa fa-plus-circle" aria-hidden="true" id="usa"></i>
</div>
</span>
</div>
和我的js函數是
function toggleMe(target, target2) {
if ($("#" + target2 + " > div > i").attr('class') == 'fa fa-plus-circle') {
$("#" + target2 + " > div > i").removeClass('fa fa-plus-circle').addClass('fa fa-minus-circle');
} else {
$("#" + target2 + " > div > i").removeClass('fa fa-minus-circle').addClass('fa fa-plus-circle');
}
$("#" + target).slideToggle("fast");
}
,但它無法正常工作。我做錯了什麼?
請界定 「_it不working_」。 – Teemu
*什麼*不起作用? – Utkanos
什麼是目標和目標2? – Mazz