I am using CKeditor, and this is my code:
...othercode..
<div class="input-field col s12">
<textarea id="textarea1" class="materialize-textarea"></textarea>
<label for="textarea1">Body of the Post</label>
</div>
<input type="submit" name="Submit" id="sub">
</form>
</div>
</div>
</div>
{{else}}
<div>You are not logged in.</div>
{{/if}}
<script>
CKEDITOR.replace('textarea1');
</script>
In Javascript, I use the same id to extract the text from the textarea, because I have to save it to collection. (Notice the handlebars.
)
When I do that, It returns the html code, and that is saved as a string inside collection, and the handlebar doesnt do anythign and displayed the same html, without giving meaning to the html tags, i.e., just lame html.
How can this be converted to string anywhere, so that, the {{body}} handlebar shows exactly how it was typed inide CKeditor, and not what the backend of ckeditor returns.
This is the output I want:
Okay
Okay
Okay
THis is the output I get:
<p>Okay</p>
<p>Okay</p>
<p>Okay</p>
You use triple braces in spacebars for this.
So your answer is
{{{body}}}