title: jQuery Tagit: Add tags using input buttons
body: <p>I'm using a really awesome plugin named <a href="https://github.com/hailwood/jQuery-Tagit/" rel="nofollow">jQuery Tagit</a> in the development of my current project.</p>
  
  <p>Everything was going (suspiciously) smooth until I attempted to add my own wee bit of jQuery. My goal was to give the end users the option to use a button to add a tag. I put some test buttons to see if it works. </p>
  
  <p>The issue? The code I developed works to paste the needed term, but the targeted input isn't seeing it as me entering a tag. It'll sit there for a few seconds then just delete automatically. Below is the code I am using so far:</p>
  
  <p>HTML:</p>
  
  <pre><code>&lt;input value="PHP" id="PHP" type="button" class="addIt"&gt;
  &lt;input value="Perl" id="Perl" type="button" class="addIt"&gt;
  &lt;input value="Java" id="Java" type="button" class="addIt"&gt;
  &lt;input value="Asp" id="Asp" type="button" class="addIt"&gt;
  
  &lt;ul id="demo1" data-name="nameOfSelect"&gt;&lt;/ul&gt;
  &lt;div class="buttons"&gt;
      &lt;button id="demo1GetTags" value="Get Tags"&gt;Get Tags&lt;/button&gt;
  &lt;/div&gt;
  &lt;div id="recordtags"&gt;
      &lt;h2&gt;Tag Records&lt;/h2&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>jQuery:</p>
  
  <pre><code>$(function () {
  
  var availableTags = [
      "ActionScript",
      "AppleScript",
      "Asp",
      "BASIC",
      "C",
      "C++",
      "Clojure",
      "COBOL",
      "ColdFusion",
      "Erlang",
      "Fortran",
      "Groovy",
      "Haskell",
      "Java",
      "JavaScript",
      "Lisp",
      "Perl",
      "PHP",
      "Python",
      "Ruby",
      "Scala",
      "Scheme"
  ];
  
  $('#demo1').tagit({
      tagSource:availableTags,
      select:true,
      sortable:true,
      allowNewTags:false,
      triggerKeys:['enter', 'comma','tab']
  });
  
  $("#demo1GetTags").click(function () { showTags($("#demo1").tagit("tags")) });
  
  function showTags(tags) {
      console.log(tags);
      var string = "";
      for (var i in tags)
          string += tags[i].value + ",";
      var result = string.slice(0,-1);
      $('#recordtags').append( result+"&lt;br&gt;" );
  }
  
  //MY CLICK FUNCTION THAT ISN'T WORKING PROPERLY
  $(".addIt").click(function(){
      var selectorTarget = "#demo1";
  
      var specificInput = " .tagit-new input.tagit-input";
      var where2paste = selectorTarget+specificInput;
      $( where2paste ).focus();
      var value = this.id;
      var pastefield = where2paste;
      var input = $(pastefield);
      input.val(input.val() + value + ',');
      return false;
  });
  
  setInterval("$('#fork').effect('pulsate', { times:1 }, 500);", 5000);
  });
  </code></pre>
  
  <p>Everything in my code works exactly as needed except for that one needed bit of functionality. :( So my question is this: what things do I need to tweak or revamp to help me add tags with the use of an input button? Thank you so much in advance. (e hugs)</p>