Skip to content

Instantly share code, notes, and snippets.

alert('hello');
@jaysylvester
jaysylvester / submit-surrogate.js
Last active August 29, 2015 14:16
A function that duplicates submit inputs as hidden inputs, for browsers that don't include the submit name/value when form.submit() is called
// Some browsers don't include the submit button's value when form.submit() is
// called. This function creates a click listener that duplicates a form's submit
// button as a hidden field so its name/value can be included in AJAX POSTs,
// allowing different processing based on different submit buttons.
// The only argument is a selector that represents the form you want to bind,
// such as '#login-form'.
// Copyright © 2015 Jason Sylvester. MIT License:
// http://opensource.org/licenses/MIT