Answer the question
In order to leave comments, you need to log in
Jquery. How to search in already found elements?
I'm making a filter on the Quicksand plugin . And there will be several groups of parameters for searching (subject, class of schoolchildren, level of training, etc.)
I have a container with objects for searching (training courses).
I clone the container.
All courses.
Then I try to find only algebra courses in the entire list of courses.
var $courses = $('#coursesContainer');
var $data = $courses.clone();
$filteredData = $data.find('.course');
$filteredData = $filteredData.end().find(.course[data-subject="Алгебра"]');
$filteredData = $filteredData.end().find(.course[data-class="7"]');
Answer the question
In order to leave comments, you need to log in
maybe you don't need a find, but a filter method?
Why clone, I don't know
var $coursesList = $('#coursesContainer .course');
var $algebraCoursesList = $coursesList.filter('[data-subject="Алгебра"]')
var $algebra7ClassCoursesList = $algebraCoursesList.filter('[data-class="7"]')
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question