jQuery filter()

Nice to use when in need of extract a subset from an array based on one or more clauses. The equivalent of the Where condition in Linq. In the below snippet we filter all the hidden fields with an Id starting with “hidden” and where the value is not empty:

var allHiddenFields = $.find('input[id^=hidden]');

var allHiddenFieldsWithValue = $(allHiddenFields ).filter(function () { return this.value != ""; })

No Comments

You can leave the first : )

Leave a Reply

Your email address will not be published. Required fields are marked *