2个问题:
<form>
更改为<textarea>
表单,我该如何调整代码?我试图改变这个事件,但形式并没有发生。 事件js
'submit form': function(e, template) {
e.preventDefault();
var $body = $(e.target).find('[name=body]');
var comment = {
body: $body.val(),
postId: template.data._id
};
var errors = {};
if (! comment.body) {
errors.body = "Input and/or attach content?";
return Session.set('commentSubmitErrors', errors);
}
Meteor.call('commentInsert', comment, function(error, commentId) {
if (error){
throwError(error.reason);
} else {
$body.val('');
}
});
html
<div class="page-content message-content">
<form class="form-send-message" data-keyboard-attach >
<!-- <form> -->
<input name="body" id="body" type="text" placeholder="content">
<a href="#" class="button" type="submit">comment</a>
<!-- <a href="#" class="link" type="submit">
<i class="icon ion-android-send"></i>
picture icon doesnt work
</a> -->
<!-- what I aim to have
<textarea placeholder="add comment" name="body" id="body"></textarea>
<a href="#" class="link" type="submit">
<i class="icon ion-android-send"></i> -->
</form>
</div>
答案 0 :(得分:0)
onConfigurationChanged
标记没有类型属性 - 您可以将其设为<a>
并根据自己的喜好设置样式,或者在<input type="submit">
标记上添加点击监听器,但最好练习将是前者