Skip to content

Instantly share code, notes, and snippets.

@ojii
Created November 8, 2011 15:54
Show Gist options
  • Save ojii/1348151 to your computer and use it in GitHub Desktop.
Save ojii/1348151 to your computer and use it in GitHub Desktop.
double-opt-in buttons
$.fn.doubleOptIn = function(){
return this.each(function(){
var ele = $(this);
ele.bind('click', function(event){
event.preventDefault();
if (ele.attr('type') == 'submit'){
ele.val(ele.attr('x-opt-in-text'));
} else {
ele.text(ele.attr('x-opt-in-text'));
}
ele.unbind('click');
});
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment