Reputation: 1635
I have a Javascript For Loop...
var CookieName = "Tab,EduTab,EduTab,user";
var tString = CookieName.split(',');
for(i = 0; i < tString.length; i++){
if (tString[i] == "EduTab") {
document.write("<b>"+tString[i]+"<b>");
} else {
document.write(tString[i]);
}
}
For some reason it is failing to bold the 'EduTab'. It will either bold the entire array CookieName or none at all. Any help would be awesome. Thanks.
Upvotes: 3
Views: 12430
Reputation: 2299
You aren't closing the <b>
tag
document.write("<b>"+tString[i]+"<b>")
should be
document.write("<b>"+tString[i]+"</b>")
Upvotes: 7