У меня есть функция, которая получает некоторые уведомления, проходит через них и добавляет их в div, используя функцию prepend в Jquery.Важная часть выглядит следующим образом
var myDiv = setNotificationDiv(notif.id, notif.title, notif.message, notif.sentDate, notif.readDate);
$('#leftContent').prepend(myDiv);
setNotificationDiv использует Array.join для создания div, который содержит всю информацию уведомления и возвращает строку
function setNotificationDiv(id, title, message, sentDate, readDate){
var temp = [];
temp.push("<div class='notification'><input type='hidden' value='");
temp.push(id);
temp.push("' name='id'/><h2>");
temp.push((title.length > 23 ? title.substring(0,23).concat('...') : title));
temp.push("</h2><div class='inlineNotification'><p id='sent'>Sent: ");
temp.push(formatDate(sentDate));
temp.push("</p>");
temp.push((readDate != null ? "<img id='read' src='content/images/readNotification.png'/>" : "<img id='read' src='content/images/unreadNotification.png'/>"));
temp.push("</div><a href='#' class='deleteNotification'><img src='content/images/deleteNotification.png'</a></div>");
var str = temp.join('');
return str;
}
Проблема заключается в том, что в IEвсе, что добавляется, это для каждого уведомления:
<img src="http://localhost:8080/content/images/deleteNotification.png" a="" <=""/>
Но в любом другом браузере, который я тестировал (Chrome, Firefox и Opera), div уведомлений выглядит так, как должен.Я понятия не имею, почему IE делает эту операцию по-другому.
Любая помощь будет принята с благодарностью
Спасибо