You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have added a JQuery plugin to the basic DM book example. It's used to create keyword tags.
When the tags are created, a new span element is created with the class tagit-label.
I'm able to get the first of the spans to store as a proper text entry in mongo, but beyond that I can't get any additional tags without them getting mushed together, as in tag1tag2tag3 versus tag1, tag2, tag3.
Even when I have tried other tag plugins, I can get the tags saved as tag1, tag2, tag3, but then accessing them from mongo seems impossible.
I'm trying to determine 2 things:
How can I store the text contents of the additional spans using the Template.postSubmit.events function?
Note, I've had some success retrieving then contents of the spans using the following:
//post_submit.js
Template.postSubmit.events({
//on 'submit' of a 'form' element, do this
'submit form': function (event) {
//prevent default form submission by browser -
//this allows event handler to 'handle' the submission
event.preventDefault();
//set a variable equal to 'post' content
var post = {
url: $(event.target).find('[name=url]').val(),
title: $(event.target).find('[name=title]').val(),
tags: $(event.target).find('[class=tagit-label').html()
};
How can I store them properly in mongo (such as in an array) so I can properly access them as key/value pairs?
I've tried a lot of different variations on dot notation, but none that properly retrieve the text.
Any help would be appreciated. I'm sure I'm missing something simple here but I can't seem to get it to work as expected.
The text was updated successfully, but these errors were encountered:
I have added a JQuery plugin to the basic DM book example. It's used to create keyword tags.
When the tags are created, a new
span
element is created with the classtagit-label
.I'm able to get the first of the spans to store as a proper text entry in mongo, but beyond that I can't get any additional tags without them getting mushed together, as in
tag1tag2tag3
versustag1, tag2, tag3
.Even when I have tried other tag plugins, I can get the tags saved as
tag1, tag2, tag3
, but then accessing them from mongo seems impossible.I'm trying to determine 2 things:
spans
using theTemplate.postSubmit.events
function?Note, I've had some success retrieving then contents of the
span
s using the following:HMTL generated by typing in keywords:
I've tried a lot of different variations on dot notation, but none that properly retrieve the text.
Any help would be appreciated. I'm sure I'm missing something simple here but I can't seem to get it to work as expected.
The text was updated successfully, but these errors were encountered: