Installation
jQuery is a dependency. Make sure it is loaded in your page, then include this just above the closing </body> tag.
<script type="text/javascript" src="path/to/file/create-tag-on-submit.js"></script>
Then replace form's submit button with <button type="button" class="createTagOnSubmit">Submit</button>
tag[name]: <input type="hidden" name="tag[name]" value="MyTagName" />
listID: <input type="hidden" name="listID" value="45575" />
returnURL: <input type="hidden" name="returnURL" value="http://google.com" />
contact_fields[field_name] to contact[field_name]
<form name="demoForm" method="post" action="">
<input type="email" name="contact[email]" placeholder="email" />
<input type="text" name="contact[first_name]" placeholder="first name" />
<input type="text" name="custom_fields[op_org_name]" value="MYDynamicOrg" />
<input type="hidden" name="returnURL" value="http://google.com" />
<input type="hidden" name="listID" value="45575" />
<input type="text" name="tag[name]" placeholder="tag" />
<button type="button" class="createTagOnSubmit">Submit</button>
</form>