HTML Font and Bold not rendering in IE 11 , but works in chrome - dynamically from javascript

I have code in which it renders just fine in Chrome, but in IE 11 it doesn't show up

Problem in IE 11 - developer tools F12

<li><ul>11/25/15 : <a href="http://server1/coc-home/#/tips/2?paginatePage=1" target="_parent">Dev Test in Supervisor Title</a> By: CBOWER</ul></li>

Works in Chrome - developer tools F12 output

<li><ul>11/25/15 : <font color="red"><b>NEW - </b></font><a target="_parent" href="http://server1/coc-home/#/tips/2?paginatePage=1">Dev Test in Supervisor Title</a> By: CBOWER</ul></li>

So basically in IE 11 browser, the javascript is completely NOT rendering the font and bold

<font color="red"><b>NEW - </b></font>   -- missing in IE rendering

My Javascript Loop the code that renders in Chrome

//add red New if date created last 10 days
var dt = new Date(formattedDateString);
var today = new Date();
var newText = "";
var dateDiffDays = Math.ceil((Math.ceil(dt.getTime() - today.getTime())) / (1000 * 3600 * 24));

if (dateDiffDays >= -10 && dateDiffDays <= 10) {
   console.log('NEW - date within 10 days');
   newText = "<font color='red'><b>NEW - </b></font>";
} else {
   console.log('OLD');
   newText = "";
}

strResult += "<li><ul>" + formattedDateString + " : " + newText + "<a target='_parent' href='http://" + dochomenotlocal + "/doc-home/#/tips/2?paginatePage=1'>" + news.title + "</a> By: " + news.createdby + "</ul></li>";

Update:

This Fiddle shows that it renders the javascript and css just fine in IE 11

http://jsfiddle.net/bthorn/yr009hwd/1/

Answers


OP is correct about the html, but that would ONLY mess up IE rendering bullet points and it would NOT omit from showing the font and bold tags

You seem to have a 2 digit year

11/25/15  

While you can have your cake and eat it to, with the javascript code that I am seeing, IE is not going to like that 2 digit year. Either spend the time to account for 2 digit year for IE OR use

11/25/2015

I could assume that you are getting the year earlier from the database or from just within javascript.

Thus your formattedDateString variable

var formattedDateString = (date.getMonth() + 1) + "/" + date.getDate() + "/" + date.getFullYear().toString();

(don't have .substr(2, 2) at the end as that is a common way to get your 2 digit year)

This "should" be the easier solution.


The HTML you are generating is invalid

<li><ul>text

The UL needs to have an li as a child, you have textNodes and other elements.


Need Your Help

Python Turtle compare colour

python python-2.7 turtle-graphics

my problem is I wanted to compare the Turtle colour but apparently there is a failure:

How to create a bar graph in Excel 2010 by counts?

excel graph

For whatever reason I can't get this to work right.