Both filter() and find() methods are very similar, except the filter is applied to all the elements while finding searches child elements only.
For that, I have used jQuery script file as follows.
<script src="scripts/jquery-1.3.2.min.js"></script>
And also, I have used simple css style shown below.
- <style type="text/css">
- div {
- padding: 6px;
- border: 1px solid;
- width: 40%;
- }
- </style>
Some of the jQuery methods I have used are listed below.
- filter() – search for all the elements.
- find() – search for all the child elements only.
Here, you can find the source code of what I have developed.
The primary output of my code is as follows:
After a click on the filter hardware then it displays the output shown below.
Then click on find hardware, then display the following output shown below.