在这里真的很努力地处理这个简单的代码。我正在检查带有#setactionsuccess 的部分是否存在,如果不存在,我想创建它并将其添加到容器中。第一部分工作顺利,但它永远不会进入“其他”(并且满足条件 - 我三重检查了)。非常感谢任何帮助。
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);
}