2 questions:
<form>
to a <textarea>
form, how should I tweak the code? I tried to change the event but the form doesnt fire. The event 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('');
}
});
The 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>
<a>
标记没有类型属性-您可以将其设置为<input type="submit">
并对其进行样式设置,或者将点击侦听器放置在<a>
标记上,但是最佳做法是前任的
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.