浏览代码

Added small example of attaching event listeners

This closes https://github.com/select2/select2/pull/4255
Kevin Brown 9 年之前
父节点
当前提交
84d6b5d840
共有 1 个文件被更改,包括 6 次插入0 次删除
  1. 6 0
      docs/_includes/options/events/jquery.html

+ 6 - 0
docs/_includes/options/events/jquery.html

@@ -50,6 +50,12 @@
     How can I attach listeners for these events?
   </h3>
 
+{% highlight js linenos %}
+$('select').on('select2:select', function (evt) {
+  // Do something
+});
+{% endhighlight %}
+
   {% include options/not-written.html %}
 
   <h3>