在这里真的很难用这个简单的代码.我正在检查是否存在#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);
}
Run Code Online (Sandbox Code Playgroud) jquery ×1