S
S
svilkov872018-02-06 20:43:06
JavaScript
svilkov87, 2018-02-06 20:43:06

How to remove items that are not selected?

Hello!

There is such a small code .

When clicking on any $blocks , we get the date attribute of this block.
The received value arrives in $resultBlock , using the text() method.
From this point on, it is considered that exactly the block whose value lies in $resultBlock is selected . How to remove all $blocks except for the selected one when the $button is clicked? You need exactly remove (), and not hide () or fadeOut () although it doesn’t matter, the main thing is to somehow separate / filter the selected ones from the unselected ones. Thank you.




Answer the question

In order to leave comments, you need to log in

1 answer(s)
L
Leonid Knyazev, 2018-02-06
@amorphis

When you click on the $blocks element, remember that it is selected. For example, through . And, when you click on the $button, filter the elements by selecting those with 'selected' = false and remove them. PS And don't forget to reset the 'selected' attribute on other elements. $(this).data('selected', true);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question