From bb3a44676ff32378bb6197685a3629a6f92c2ab5 Mon Sep 17 00:00:00 2001 From: Leif Johansson Date: Mon, 8 Oct 2012 14:03:19 +0200 Subject: - utility jquery plugin for turning links into form submit buttons --- static/js/jquery.submitter.js | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 static/js/jquery.submitter.js (limited to 'static/js') 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 -- cgit v1.1