簡體   English   中英

item已添加到標簽Input Bootstrap中

[英]itemAdded in Tags Input Bootstrap

在將標簽添加到輸入框后,我嘗試做一些事情,我知道標簽輸入引導中有一個名為itemAdded的事件。 但是我不為什么,但是我的代碼不起作用。

HTML:

`<input id = "zipcode" method ="post" type="text" class = "m-wrap tags" />`

JS:

<script type="text/javascript">
  $(document).ready(function() {
    $('.tags').tagsInput({
            'width': 'auto',
            'defaultText': 'e.g. 48108'
  });
});

  $('#zipcode').on('itemAdded', function(event) {
      // do something with event.item at here. example:
      alert(event.item);
  });

</script>

不知道為什么這不起作用。 當我輸入新標簽時,什么也沒發生。

謝謝。

您為什么不只使用更改,模糊或鼠標離開事件? 您可能還需要仔細檢查HTML。 它的格式可能不正確。 IE id和class屬性之間的多余空格。

<input id="zipcode" method ="post" type="text" class="m-wrap tags" />

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM