ここでこの単純なコードに本当に苦労しています。#setactionsuccess を含むセクションが存在するかどうかを確認しています。存在しない場合は、セクションを作成してコンテナーの先頭に追加します。最初の部分はスムーズに動作しますが、「else」にはなりません (そして条件が満たされている - 私はそれをトリプルチェックしました)。どんな助けでも大歓迎です。
if ($('#setactionsuccess')){
var currenttime = new Date();
$('#setactionsuccess').empty();
$('#setactionsuccess').html('<h2>Set successfully deleted</h2><p>Set was successfully removed from this Edition on '+currenttime+'</p>');
} else {
console.log('here');
var string = '<section class="successful" id="setactionsuccess"><h2>Set successfully deleted</h2><p>Set was successfully removed from this Edition on '+currenttime+'</p></section>';
console.log(string);
$('#currentsets').prepend(string);
}