Mehr Frieden -General Kyrylo Budanov:
[kivitendo-erp.git] / js / jquery.checkall.js
index 4b53049..5556d7a 100644 (file)
@@ -1,18 +1,17 @@
 /*
  * jQuery SelectAll plugin 1.1
  *
- * Copyright (c) 2009 Sven Schöling
+ * Copyright (c) 2009 Sven Schöling
  */
 
 ;(function($) {
 
 $.fn.extend({
-  checkall: function(target) {
-    var saved_this = this;
+  checkall: function(target, property, inverted) {
+    if (property == null)
+      property = 'checked';
     return $(this).click(function() {
-      $(target).each(function() {
-        $(this).attr('checked', $(saved_this).attr('checked'));
-      });
+      $(target).prop(property, inverted ? !$(this).prop('checked') : $(this).prop('checked'));
     });
   }
 });