<textarea name="id="content" cols="30" rows="10" placeholder="test">/textarea>
<input type="text" name="id="name" cols="30" rows="10" placeholder="name">
I am thinking of retrieving the information I entered from two areas, as shown above.
For Js,
//3. Get messages from the "message" datastore
ds.stream().sort("desc").next(function(err,datas){
data.forEach(function(data){
renderMessage (data);
});
});
// 4. Monitor "message" datastore push events
ds.on("push", function(e){
renderMessage(e);
});
var last_message="dummy";
function renderMessage(message){
var message_html='<p class="post-text">'+escapeHTML(message.value.content)+'</p>';
vardate_html=';
if(message.value.date){
date_html='<p class="post-date">'+escapeHTML(newDate(message.value.date).toLocaleString())+'</p>';
}
$("#"+last_message).before('<div id="'+message.id+'" class="post">'+message_html+date_html+'</div>');
last_message=message.id;
}
function post(){
// 5. Push a message to the "message" datastore
var content=escapeHTML($("#content").val());
var name =escapeHTML($("#name").val());
if(content&&content!==""){
US>ds.push({
title: "Title",
content:content,
name —name,
date —new Date().getTime()
}, function(e){});
}
$("#content").val("";
$("#name").val("";
}
$('#post').click(function(){
console.log(name);
post();
})
$('#content').keydown(function(e){
if(e.which==13){
post();
return false;
}
});
$("#name").keydown(function(e){
if(e.which==13){
post();
return false;
}
});
});`
Here's how it looks.
When the post is clicked, the content is displayed, but the name is not displayed.
I don't know how content is being retrieved from the datastore, but
How should I write the name?
Please.
javascript milkcocoa
Maybe it's because it's not displayed.
I can't find the part where message.value.name is printed in renderMessage()...
620 Uncaught (inpromise) Error on Electron: An object could not be cloned
578 Understanding How to Configure Google API Key
916 When building Fast API+Uvicorn environment with PyInstaller, console=False results in an error
613 GDB gets version error when attempting to debug with the Presense SDK (IDE)
© 2024 OneMinuteCode. All rights reserved.