title: Adding a X remove button to a tag
body: <p>I have found this <a href="http://jsfiddle.net/6xpoeth6/1/" rel="nofollow noreferrer">http://jsfiddle.net/6xpoeth6/1/</a> script on this "<a href="https://stackoverflow.com/questions/25487012/how-to-create-a-non-editable-typelike-tags-when-a-button-is-pressed">How to create a non-editable type(like tags) when a button is pressed</a>" page. Can anybody add a X button to remove the post like on this "<a href="http://timschlechter.github.io/bootstrap-tagsinput/examples/" rel="nofollow noreferrer">http://timschlechter.github.io/bootstrap-tagsinput/examples/</a>" plugin or like on the tag input on this website?</p>
  
  <p>Here is the code:</p>
  
  <p>HTML</p>
  
  <pre><code>&lt;input class="btn btn-info attribute-button" name="commit" type="button" value="first_name" /&gt;
  &lt;input class="btn btn-info attribute-button" name="commit" type="button" value="second_name" /&gt;
  
  &lt;div class="tags"&gt;
      &lt;input type="text" name="newtag" class="newtag" placeholder="Add tags" /&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>CSS</p>
  
  <pre><code>.tags{
      width: 400px;
      height: 100px;
      border: 1px solid #000;
      margin: 5px;
  }
  .tag{
      padding: 1px;
      background-color: blue;
      color: #fff;
      border-radius: 3px;
      display: inline-block;
  }
  .newtag{
      border: none;
      outline: none !important;
  }
  </code></pre>
  
  <p>JS</p>
  
  <pre><code>$(document).ready(function(){
      $(".tags, .attribute-button").click(function(){
          $(".newtag").focus();
      })
      $(".newtag").keydown(function(e){
          if(e.which === 13 || e.which === 32 || e.which === 9){
              e.preventDefault();
              $(".newtag").before("&lt;div class='tag'&gt;"+$(".newtag").val()+"&lt;/div&gt;");
              $(".newtag").val("");
          }
      });
      $(".attribute-button").click(function(){
          $(".newtag").before("&lt;div class='tag'&gt;"+$(this).val()+"&lt;/div&gt;");
      })
  });
  </code></pre>
  
  <p>Thanks</p>