JQueryを使用して「展開-展開解除」関数を作成しようとしました。ユーザーが展開をクリックすると、div の子が表示されます。ユーザーが unexpand をクリックすると、div の子が消えます。しかし、うまくいきません。
これが私のコードです:
$(document).ready(function(){
$('.expand').click(function(){
var id = $(this).attr('id');
$(this).html("-");
$(this).attr("class", "unexpand");
$.post("classes/ajax_laporan.php",
{
id: id
},
function(data){
}
);
});
$('.unexpand').click(function(){
$(this).html("+");
$(this).attr("class", "expand");
});
})
この問題を解決するのを手伝ってくれる人はいますか? 前もって感謝します。