summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeif Johansson <leifj@sunet.se>2012-10-08 14:03:19 +0200
committerLeif Johansson <leifj@sunet.se>2012-10-08 14:03:19 +0200
commitbb3a44676ff32378bb6197685a3629a6f92c2ab5 (patch)
treeb8743b7eb3664122c9c710b6f1b382fe8727c812
parent41fa7050766d3ad5a57c83faacd3031fc9fa35bf (diff)
- utility jquery plugin for turning links into form submit buttons
-rw-r--r--static/js/jquery.submitter.js11
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