From 48365e43e9a635cb76cb4cd2fff08d1134bd304e Mon Sep 17 00:00:00 2001
From: Peter Beno <najlepsiwebdesigner@gmail.com>
Date: Wed, 2 Jan 2013 11:06:55 +0100
Subject: [PATCH] Added elemental implementation of onchange event

---
 index.html                  | 4 +++-
 js/bootstrap-multiselect.js | 2 ++
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/index.html b/index.html
index eb1f7f6..6510c87 100644
--- a/index.html
+++ b/index.html
@@ -16,7 +16,9 @@
 	<body>
 		<script type="text/javascript">
 			$(document).ready(function() {
-				$('#example1').multiselect();
+				$('#example1').multiselect({
+					onchange:function(){alert('change event invoked!');}
+				});
 				$('#example2').multiselect();
 				$('#example3').multiselect({
 					button: 'btn btn-link'
diff --git a/js/bootstrap-multiselect.js b/js/bootstrap-multiselect.js
index 77f75a3..0f87390 100644
--- a/js/bootstrap-multiselect.js
+++ b/js/bootstrap-multiselect.js
@@ -68,6 +68,7 @@
 			$('option[value="' + $(event.target).val() + '"]', this.select).attr('selected', checked);
 			
 			$('button', this.container).html(this.options.text($('option:selected', this.select)) + ' <b class="caret"></b>');
+			this.options.onchange();
 		}, this));
 		
 		$('ul li a', this.container).on('click', function(event) {
@@ -99,6 +100,7 @@
 				}
 			},
 			container: '<div class="btn-group" />',
+			onchange:function(){}
 		},
 
 		constructor: Multiselect,
-- 
2.22.0