What is the correct approach to use filter()?
I am using the
filter() and I am wondering is this correct approach?
Using filter, It look for matching
noteid and remove the image.
From the jQuery docs:
Reduce the set of matched elements to those that match the selector or pass the function’s test.
Therefore I’d suggest using the
.filter() method to reduce the selected elements, and then chain additional methods on the matched elements.
In your case, you could use:
If you don’t modify your code, then
.each() may be a better substitute for
.filter() since you a merely iterating over the code: