表示属性を変更して非表示のフォーム要素を表示する

表示属性を変更して非表示のフォーム要素を表示する

によって非表示になっているフォーム要素を表示する Firefox のブックマークレットを作成するにはどうすればよいですかdisplay: none;?

答え1

私の理解が正しければ、必要に応じて属性formを変更して、すべての要素と関連要素が表示されるように設定したいということですね。これは JavaScript と jQuery で行うことができます。display


グリースモンキーユーザースクリプト:

// ==UserScript==
// @name        Show Form Elements
// @namespace   http://igalvez.net
// @description Modifies form elements' display attributes to reveal them.
// @version     1.0
// @require     http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js
// ==/UserScript==

var elements = ['form', 'input', 'textarea', 'label', 'fieldset', 'legend',
                'select', 'optgroup', 'option', 'button'];
for (var i = 0; i < elements.length; i++)
{
    $(elements[i]).each(
        function()
        {
            $(this).show();
        }
    );
}

ブックマークレットURL:

javascript:(function(e,a,g,h,f,c,b,d){if(!(f=e.jQuery)||g>f.fn.jquery||h(f)){c=a.createElement("script");c.type="text/javascript";c.src="http://ajax.googleapis.com/ajax/libs/jquery/"+g+"/jquery.min.js";c.onload=c.onreadystatechange=function(){if(!b&&(!(d=this.readyState)||d=="loaded"||d=="complete")){h((f=e.jQuery).noConflict(1),b=1);f(c).remove()}};a.documentElement.childNodes[0].appendChild(c)}})(window,document,"1.3.2",function($,L){var%20elements=["form","input","textarea","label","fieldset","legend","select","optgroup","option","button"];for(var%20i=0;i<elements.length;i++){$(elements[i]).each(function(){$(this).show()})};});

(生成に使用)Ben Alman の jQuery ブックマークレット道具)

関連情報