Skip to content

Instantly share code, notes, and snippets.

@zackbloom
Last active August 29, 2015 14:07
Show Gist options
  • Select an option

  • Save zackbloom/2c35b3d14bf4907db16c to your computer and use it in GitHub Desktop.

Select an option

Save zackbloom/2c35b3d14bf4907db16c to your computer and use it in GitHub Desktop.
.gotcha {
width: 100%;
}
.gotcha:after {
content: "OPT OUT OF OUR WEEKLY NEWSLETTER";
padding-left: 40px;
}
.gotcha:checked:after {
content: "I WANT TO RECEIVE OCCASIONAL EMAILS ABOUT NEW PRODUCTS, PROMOTIONS AND OTHER NEWS";
}
document.addEventListener('DOMContentLoaded', function(){
var form = document.querySelector(INSTALL_OPTIONS.form.selector);
var checkbox = document.createElement('input');
checkbox.setAttribute('type', 'checkbox');
checkbox.setAttribute('class', 'gotcha');
var submit = form.querySelector('input[type=submit]');
if (submit){
form.insertBefore(checkbox, submit);
} else {
form.appendChild(checkbox);
}
})
{
"resources": {
"head": [
{
"type": "style",
"src": "./gotcha.css"
},
{
"type": "script",
"src": "./gotcha.js"
}
]
},
"options": {
"properties": {
"form": {
"title": "Form",
"type": "object",
"format": "element"
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment