I have the following code , in which I want to hide last two items in a div :
$('.toggleRoom').click(function() {
$('.showRooms').slice(-2).remove();
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="showRooms">
<div>1</div>
<div>2</div>
<div>3</div>
</div>
But its not working, The last two divs are not removing.
What am I missing ?