Skip to content

Instantly share code, notes, and snippets.

@todoubled
Last active December 11, 2015 07:49
Show Gist options
  • Save todoubled/4569150 to your computer and use it in GitHub Desktop.
Save todoubled/4569150 to your computer and use it in GitHub Desktop.
$(function() {
// add/show/hide .add-note button on hover
$('.module-body').hover(
function() {
var myel = $('> button.add-note', this).length ? $('> button.add-note', this) : $('<button class="btn btn-small add-note">Add Note</button>').appendTo(this);
$('.add-note', this).show();
},
function() {
$('.add-note', this).hide();
}
);
// do something when clicking the button
$('.module-body').on('click', '.add-note', function(e) {
$(this).toggleClass('booyah');
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment