diff options
author | Leif Johansson <leifj@sunet.se> | 2012-10-08 14:03:19 +0200 |
---|---|---|
committer | Leif Johansson <leifj@sunet.se> | 2012-10-08 14:03:19 +0200 |
commit | bb3a44676ff32378bb6197685a3629a6f92c2ab5 (patch) | |
tree | b8743b7eb3664122c9c710b6f1b382fe8727c812 | |
parent | 41fa7050766d3ad5a57c83faacd3031fc9fa35bf (diff) |
- utility jquery plugin for turning links into form submit buttons
-rw-r--r-- | static/js/jquery.submitter.js | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/static/js/jquery.submitter.js b/static/js/jquery.submitter.js new file mode 100644 index 0000000..47352ed --- /dev/null +++ b/static/js/jquery.submitter.js @@ -0,0 +1,11 @@ +jQuery.fn.submitter = function() { + this.each(function() { + var that = $(this); + that.click(function(ev) { + ev.preventDefault(); + var form = $(that.attr('data-form')); + form.attr('action',that.attr('href')); + form.submit(); + }) + }) +};
\ No newline at end of file |