About the book<Discover Meteor>,about inserting pictures


Reference to posting function in book , I expand a bit : You can insert a picture when posting ( replaced “textarea” by an editable “DIV” ), this has been achieved.Now I don’t know how to handle the submit? The book was only publishing of text only, by “content: $( e. Target ).Find ( ‘[name=content]’ ). val ( )” that gets the post content, then display . now there are pictures, how to deal with it?Is there a method similar to .val ( ) that can get the entire contents of the DIV ( including images )?

The way of getting the post content now used,it is easy:
var post={


You can get the contents of a div using innerHTML.


Thank you,but it display html code :

My code:
var post={

return this.content;

<template name="postContent">


You can use triple braces{{{content}}}, but you should always be careful when using them!!!

If the content is user-generated, then you will need a way to sanitize it so that malicious code can’t be inserted into a page that one of your users may visit.


Thank you very much!! You really are a nice person.