Hi,

I add elements to set this way:

jQuery.fn.pushIf = function(selector_or_nodes) {
                                          var nodes = (typeof a == 'string') ?
                                          $(selector_or_nodes) : 
selector_or_nodes;
                                          var node_count = nodes.length;
                                          for(var i = 0; i < node_count; i++) {
                                                  var exists = false;
                                                  for (var j = 0; j < 
this.length; j++) {
                                                          if (this[j] == nodes[ 
i ]) {
                                                                  exists = true;
                                                                  break;
                                                          }
                                                  }
                                                  if (!exists) {
                                                          this[ this.length++ ] 
= nodes[ i ]
                                                  };
                                          }

 $.extend({
                                                   validation: {
                                                           invalidFields: $([]),


                                                           addInvalidField: 
function(field) {
//Add fields here
                                                                   
this.invalidFields.pushIf($(field));
                                                           }
});

                                  };



I want to have function removing from invalidFields, like that:

jQuery.fn.remove = function( selector_or_nodes ) {

                                          var nodes = (typeof a == 'string') ?
                                          $( selector_or_nodes ) : 
selector_or_nodes;
                                          var node_count = nodes.length;
                                          for( var i = 0; i < node_count; i++ ) 
{
                                                  for (var j = 0; j < 
this.length; j++) {
                                                          if (this[j] == nodes[ 
i ]) {
                                                                 
alert('fffound!');
                                                                  // delete 
this item here
// I would use splice if this was an array, but this is jQuery object
                                                                 break;
                                                         }
                                                  }
                                          }
                                  };

How to delete item if fffound?

--
regards,
takeshin

Reply via email to