I am working on a project involving Javascript and I need a string to be underlined. The code has the word "Date" in front of the current date (represented by the variable now). The current date needs to be underlined, not the word "Date".
This is the code I am using:
var now = new Date();
document.getElementById('date').innerHTML = "Date " + (now.getMonth()+1)+ "/"+ now.getDate()+ "/"+ now.getFullYear();
How can I do this?
Use CSS for presentation:
Snippet
Also, please note, there should not be any duplication of
ids. So if there are multipledateelements in the same page, useclassinstead and style this way:Preview