views:

103

answers:

1

Take a look at this snazy plugin: http://remysharp.com/2007/12/28/jquery-tag-suggestion/ ** it's real small Source: http://remysharp.com/downloads/tag.js

For the life of me, I can't figure out where in the plugin JS the code is injecting the SPAN which contains the tags...

I see the following around line 73:

var tagMatches = document.createElement(settings.tagContainer);

But where is it injecting it into the doc? I ask because I need to find a way to control where it goes based on an ID, something like this:

document.body.insertBefore(newDiv, my_div);

Thanks so much, and good luck, It's tricky!

+4  A: 

It's inserted here:

tagsElm.after(tagMatches).keypress(handleKeys).keyup(handleKeys).blur(function () {
  if (fromTab == true || suggestionsShow) { // tweak to support tab selection for Opera & IE
    fromTab = false;
    tagsElm.focus();
  }
});

Specifically the after() call.

cletus
Above this, there is: var tagsElm = $(this);I updated that to: var tagsElm = $('.helper'); which ended up breaking it, no error, it just stops working. Is this inline with what you were suggesting?
AnApprentice