3
I need to assign the current date in a field datetime
one-paragraph, for that I implemented:
...
var newDate = new Date(),
date = newDate.getFullYear() + "-" + (newDate.getMonth() + 1) + "-" + newDate.getDate() + " " + newDate.getHours() + ":" + newDate.getMinutes() + ":" + newDate.getSeconds();
$(".container").append("<p id=msg" + id + " class='message' datetime=" + date + ">" + userMessage + "</p>");
...
When inspecting in the browser the entered information is incorrectly formatted:
<p id="msg1" class="message" datetime="2015-2-23" 11:26:48="">teste</p>
What I need to correct for the result to be like this?:
<p id="msg1" class="message" datetime="2015-2-23 11:26:48">teste</p>
I don’t understand why that question got -1
– MarceloBoni