Skip to content

Instantly share code, notes, and snippets.

@unr
Created October 30, 2015 01:38
Show Gist options
  • Select an option

  • Save unr/9d60063b3a4851b3170d to your computer and use it in GitHub Desktop.

Select an option

Save unr/9d60063b3a4851b3170d to your computer and use it in GitHub Desktop.
$('.js-toggle-link').on('click', function(e) {
var target = $(e.currentTarget).data('toggle-target');
$(target).toggle();
});
<a class='js-toggle-link' data-toggle-target='#someID'>Click me to toggle</a>
<div id='someID'>This should toggle when above is clicked.</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment