diff --git a/bower.json b/bower.json
index b7c7245..442ed4c 100644
--- a/bower.json
+++ b/bower.json
@@ -12,6 +12,7 @@
"checkboxes",
"jquery",
"plugin",
+ "randomcheck",
"check",
"uncheck",
"range",
diff --git a/src/jquery.checkboxes.js b/src/jquery.checkboxes.js
index ce7026d..4cff3c1 100644
--- a/src/jquery.checkboxes.js
+++ b/src/jquery.checkboxes.js
@@ -14,6 +14,17 @@
var Checkboxes = function (context) {
this.$context = context;
};
+
+ /**
+ * Random check all checkboxes in context. New!!! By cottayson
+ */
+ Checkboxes.prototype.randomcheck = function () {
+ this.$context.find(':checkbox')
+ .filter(':not(:disabled)')
+ .each(function () {
+ $(this).prop( 'checked', parseInt(2*Math.random()) );
+ });
+ };
/**
* Check all checkboxes in context.
diff --git a/tests/test.html b/tests/test.html
index 54caee6..5b38099 100644
--- a/tests/test.html
+++ b/tests/test.html
@@ -44,9 +44,12 @@
Check all
- Uncheck all
+ Check random