Created
July 5, 2017 13:24
-
-
Save mhz-tamb/127ae92085141522389165ff2ad0c6b0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function() { | |
'use strict'; | |
function createElement(tagName, attributes) { | |
return Object.assign(document.createElement(tagName), attributes); | |
} | |
var privacyPolicyContainer = createElement('div', {className: 'form-control'}); | |
privacyPolicyContainer.appendChild(createElement('input', {name: 'privacy-policy', type: 'checkbox', checked: true, required: true})); | |
privacyPolicyContainer.appendChild(createElement('label', {htmlFor: 'privacy-policy', innerHTML: 'Согласен на обработку моих персональных данных'})); | |
var excludeForms = []; | |
document.addEventListener('DOMContentLoaded', function() { | |
Array.prototype.forEach.call(document.forms, function(form) { | |
if (!excludeForms.includes(form.name)) { | |
form.insertBefore(privacyPolicyContainer, form.elements.lastChild); | |
} | |
}); | |
}); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment