Skip to content

Instantly share code, notes, and snippets.

Created November 23, 2014 13:14
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
// ==UserScript==
// @name Input Disabler
// @namespace
// @version 0.1
// @description This script allows you to disable any HTML inputs you find across the web!
// @author ṧнʊß (shub)
// @match http://*/*
// @match https://*/*
// ==/UserScript==
function addButtonBefore(inputItem) {
var button = document.createElement("button");
var text = document.createTextNode("eliminate");
cssString = "font-size: 9px; border: 0; border-radius: 10px; outline: none;" = cssString;
button.setAttribute("title", "disable / enable this element")
button.addEventListener('click', function(e) {
var state = inputItem.disabled;
inputItem.disabled = !state;
e.cancelBubble = true;
e.returnValue = false;
return false;
inputItem.parentNode.insertBefore(button, inputItem.nextSibling.nextSibling); //Doubled .nextSibling because some elements have text after them. Difference is unnoticeable for elements without text.
}'answer'), function(inputItem) {
Copy link

shu8 commented Nov 23, 2014

This was specifically designed as an answer to this (on Software Recommendations Beta SE). It will work with radio buttons in a group called 'answer'. You can easily change this by changing line 31 answer to the radio button group name.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment