I need to change html in Node.js.
1 i have to read date from datecenter
2 i have to change or add html code in NODE
actualy i need to read date and write it into html file
there is javascript code i point where i have to change html
var mysql = require("mysql");
var connection = mysql.createConnection({
host: 'localhost',
user: 'testuser',
password: 'a',
database: 'test',
port: 3306
});
connection.connect();
var read = connection.query("SELECT `Name` FROM `fruids`",function(error, result){
if(error) throw error;
console.log(result);
});
//~~~~~here i have to change inner
connection.end();
this is html below
<html>
<head>
<title>Регистрация</title>
<meta charset="utf-8" />
<style>
p{
text-align: right;
margin-right: 252px;
margin-top: -8px;
}
</style>
</head>
<body>
<h1>Введите данные</h1>
<form action="/register" method="post">
<label>Имя</label><br>
<input type="text" name="userName" /><br><br>
<label>Email</label><br>
<input type="text" name="userAge" /><br><br>
<label>Повідомлення</label><br>
<textarea type="text" name="userMess" ></textarea><br><br>
<input type="submit" value="OK" />
<input type="reset" value="Стерти" />
</form>
<form>
<h1 style="text-align: right;
margin-top: -284px;
margin-right: 170px;
">Повідомлення</h1>
<p class="inner" id="mesager">xss</p>
</form>
</body>
</html>
can i do something like this
var date;
var node;
node.nodeValue = node.nodeValue.replace(/lol/, "<span>"+date+"</span>")