Skip to content

Instantly share code, notes, and snippets.

@jwoodlee
Created February 19, 2012 13:35
Show Gist options
  • Save jwoodlee/1863867 to your computer and use it in GitHub Desktop.
Save jwoodlee/1863867 to your computer and use it in GitHub Desktop.
Jquery Tips
Binding a parametrized a non anonymous function to a button in jquery
Say you have the function
function buildDialog( parentId ){
alert(parentId);
return false;
}
And the following link <a href="5" class="attach">Do Something</a>
You can bind it to a like like
$('.attach').button.bind('click', {parentId: <%=current_user.id%>}, buildDialog);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment