alexgorbatchev/jquery-textext

Can't call plugin methods or maybe just documentation issue

evereq opened this issue · 7 comments

Perfect code, excellent documentation & cool examples...
However I can't found what I need :( for some reason.
All I need is to simply add few tags using Javascript into already created input element, not during initialization (using perfect declarative way which shown 1000s times in docs / examples)
I.e. I go over all docs, but seems can't found the way how to invoke textext plugin methods!
For example, if I need to call some methods in 'ItemManager' (http://textextjs.com/manual/itemmanager.html), I can easy do something like (the bad thing that no such examples at all in the docs):

  var textext = $('#keywords').textext()[0];
  var item =  textext.itemManager().stringToItem('cool');

However, when I tried to call something like:

  var textext = $('#keywords').textext()[0];
  var item =  textext.tags().addTags(['hello','shit']);

It just fails....

The same happens with:

  var textext = $('#keywords').textext()[0];
  var item =  textext.TextExtTags.addTags(['hello','shit']);

etc.

I.e. seems can't found any "easy" way to call dirrectly plugin methods??? Strange.. because I think every such library should have at least methods which are easy accessible and documented well, like $('#keywords').textext()[0].addTags('hello','shit') or var tags = $('#keywords').textext()[0].getTags() etc.

Am I miss something?

Big thanks!

Any news? Because right now it just drive me crazy :D To get tags that was entered, I issue following undocumented code (founded reviewing SOURCE HTML of the following page http://textextjs.com/manual/examples/tags.html ...):
var textext = $('#keywords').textext()[0];
var tags = textext.hiddenInput().val();
Should be some easy / well documented way to get entered tags, what you think??? :)

+1
Simple question: How do you add TextExt tags programmatically?

On http://textextjs.com/manual/examples/tags.html I see an addTags(tags) method... but can't find the pointer to call it correctly.

@seanodotcom @evereq Thanks for feedback, I released "emergency" 1.2.0 which just includes this feature, please see the demo

http://textextjs.com/manual/examples/tags-adding.html

excellent and quick! Thanks! :)

Side note: if you select order of plugins for example like "plugins: 'prompt focus autocomplete arrow tags'" than yes, feature works. However if you use order like 'tags prompt focus autocomplete arrow' new feature do NOT work for some reason :) Spend few minutes today to figure out this :D Seems you may need to fix it in next version ;-)

I used this to add any text remaining in the input as a tag upon form submission (something I think is expected behavior for tag inputs, by the way).

I can confirm evereq's issues as well: the feature will expect 'tags' to be the last plugin specified in the options parameters. Otherwise, it will select whichever plugin is last instead.

   $('#form_element').submit(function(){
      var input_element = $('.textext-input-element');
      input_element.textext()[0].tags().addTags([ input_element.val() ]);
      input_element.val("");
   });

Hi evereq!
Try it:
$('#keywords').textext()[0].tags().addTags([ { name: 'Hello', id: '1' },{ name: 'Shit', id: '2' } ]);