我正在尝试动态地将手风琴元素添加到我的DOM中,我似乎无法正确添加它,以便新元素将具有它的ID,适当的类等...
这是我的代码:
function addAccordion(esr){
var elementID = document.getElementById("ThreatMainDiv_" + esr.marking);
var emittersDiv = document.getElementById("Emitters");
if(elementID != null){
return;
}
var marking = esr.marking;
var tmp;
tmp = "\"" + "ThreatMainDiv_" + marking + "\"";
var topDiv = '<div id='+ tmp + ' class="accordionTitle"><h1 style="font-size: 16px"></h1></div>';
var tDiv = document.createElement('div');
tDiv.innerHTML = topDiv;
$('#Emitters').append(tDiv);
};
如何正确添加?
答案 0 :(得分:0)
更改
$(document).on('click','.accordionTitle',function(){});
带
public static void SendNewsletter(string fromAccount, string subject, string eMailText)
{
var userEMailAddresses = new List<string>();
using (var dbContext = new dbEntities())
{
userEMailAddresses =
dbContext
.User
.Where(w =>
!w.IsDeactivated &&
!w.IsBlacklisted)
.Select(s =>
s.UserName)
.ToList();
}
new Thread(() =>
{
for (int i = 0; i < userEMailAddresses.Count; i++)
{
SendMail(fromAccount, userEMailAddresses[i], subject, eMailText);
}
}).Start();
}