Custom filters (Become an expert)
We've learned all of the available jQuery's filters. In some cases you may need a shortcut to collect elements for which jQuery doesn't provide a specific filter. This is exactly where custom filters come into play.
How to do it...
Our goal is to print the length of the elements having the placeholder attribute set, taking advantage of a previously created custom filter. In addition, to see all of the available options in action, we'll create a second filter to collect all of the elements having a name with less than a given number of characters.
To complete the task, follow these steps:
- Create a copy of the
form-filters.htmlfile and rename it as
- Edit the
<head>section of the page, replacing ...