Skip to content

Instantly share code, notes, and snippets.

@tevashov
Last active October 27, 2022 21:39
Show Gist options
  • Select an option

  • Save tevashov/5172492 to your computer and use it in GitHub Desktop.

Select an option

Save tevashov/5172492 to your computer and use it in GitHub Desktop.
Hide all children div except a specific one #jQuery
$('#target div:not(#exclude)').hide();
//or
$('#target').children().filter(':not(#exclude)').hide();
@ItsMurumba
Copy link
Copy Markdown

This code worked for me. You can replace $(this).val() with #target
$('.'+ $(this).val()).show(); $('.tabcontent2 tr:not(.'+ $(this).val() +')').hide();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment