zurb/foundation — Issue #230: jQuery.placeholder breaks chaining
Author: rusteater
Created: 2012-01-15 05:08:06+00:00
State: open

Here's the code that kicks off the placeholder loop:

return this.filter(":input").each(function(index) {

this [filters the current jQuery object to only certain form controls](http://api.jquery.com/input-selector/). However, in its current state, it returns this filtered set, breaking the chain if any of the element in the object were filtered out.

---

The solution is simple. After the final loop, simply remove the filter with [`.end()`](http://api.jquery.com/end/):

.each(function(index, elem) {
// Some code
}).end();

---

**On a side note:** why do all the anonymous functions created with `new` ? Why not simply `(function(){})(args)`?