Skip to content

Instantly share code, notes, and snippets.

View mtgto's full-sized avatar

Satoshi Goto mtgto

  • Japan
  • 02:30 (UTC +09:00)
  • X @mtgto
View GitHub Profile
@masuhajime
masuhajime / gist:e7b8b4cab6c6037f1bbe
Created March 12, 2015 06:30
html中の<input type="radio"> をランダムに選択するBookMarklet
javascript:(function(){var url='//ajax.googleapis.com/ajax/libs/jquery/2.0.2/jquery.min.js';if(!url.match(/\?/))url+='?t='+(new Date()).getTime();var d=document;var e=d.createElement('script');e.charset='utf-8';e.src=url;d.getElementsByTagName('head')[0].appendChild(e);function shuffle(t){for(var n,u,h=t.length;h;)u=Math.floor(Math.random()*h--),n=t[h],t[h]=t[u],t[u]=n}var inputs=[];$("input[type=radio]").each(function(){inputs.push($(this))}),shuffle(inputs);for(var j=0;j<inputs.length;j++)inputs[j].prop("checked",!0);})();