Skip to content

Instantly share code, notes, and snippets.

@tmsss
Created November 14, 2013 10:51
Show Gist options
  • Select an option

  • Save tmsss/7464865 to your computer and use it in GitHub Desktop.

Select an option

Save tmsss/7464865 to your computer and use it in GitHub Desktop.
Drupal 6 jQuery behaviors (toggle example)
Drupal.behaviors.toggle = function(context) {
/*Add your js code here*/
$('#day').hide();
$("#show-example").click(function () {
if ($('#day').is(":visible")) {
$(this).html($(this).html().replace(/Hide/, 'Show'));
} else {
$(this).html($(this).html().replace(/Show/, 'Hide'));
}
// Do it afterwards as the operation is async
$('#day').toggle();
console.log('code');
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment