I used textarea tag instead this div[contentEditable="true] before, but it have an issue with text resizing on user typing; and this is the code, that worked in textarea version:
Template.mainFrame.events({
'click button': function(e, t) {
var inputted = t.find('#textarea').value;
Session.set('input', inputted);
t.find('#textarea').value = '';
}
});
Template.mainFrame.someValue = function(){
return Session.get('input');
};
html:
<section>
<div class="input">
<div contentEditable="true" placeholder="type here" id="textarea">
Lorem ipsum sit dolor
</div>
<button>
click me
</button>
</div>
<div class="output">
{{#markdown}}
{{someValue}}
{{/markdown}}
</div>
</section>
But now it is not working; I guess .value method only could be applicable to textarea or inputs and this kind of stuff;
So, the question is: which method in meteor do I use to select content inside div?
This is not a meteor question, but really just about javascript (or jQuery to be precise).
The answer from here is that you can use:
var inputted = t.find('#textarea').html();
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.