Skip to main content
This is HTML and JavaScript
Source Link

JavaScriptHTML + JavaScript, 175 148 139 135 69 Bytes

Golfed:

<input value="c"onclick="this.select();document.execCommand('copy')"> 

Fiddle

Ungolfed

Got help from SitePoint

HTML:

<input style="display: none;" id="Empty" value="x"> <input id="clipclear" type="button" value="Clear The Clipboard"> 

JS:

function clearclip(){ empty=document.getElementById("Empty"); empty.style.display="block"; empty.select(); document.execCommand('copy'); empty.style.display="none"; } document.getElementById("clipclear").addEventListener("click", clearclip, false); 

JavaScript 175 148 139 135 69 Bytes

Golfed:

<input value="c"onclick="this.select();document.execCommand('copy')"> 

Fiddle

Ungolfed

Got help from SitePoint

HTML:

<input style="display: none;" id="Empty" value="x"> <input id="clipclear" type="button" value="Clear The Clipboard"> 

JS:

function clearclip(){ empty=document.getElementById("Empty"); empty.style.display="block"; empty.select(); document.execCommand('copy'); empty.style.display="none"; } document.getElementById("clipclear").addEventListener("click", clearclip, false); 

HTML + JavaScript, 175 148 139 135 69 Bytes

Golfed:

<input value="c"onclick="this.select();document.execCommand('copy')"> 

Fiddle

Ungolfed

Got help from SitePoint

HTML:

<input style="display: none;" id="Empty" value="x"> <input id="clipclear" type="button" value="Clear The Clipboard"> 

JS:

function clearclip(){ empty=document.getElementById("Empty"); empty.style.display="block"; empty.select(); document.execCommand('copy'); empty.style.display="none"; } document.getElementById("clipclear").addEventListener("click", clearclip, false); 
Still Shaving off bytes.
Source Link
TecBrat
  • 222
  • 1
  • 9

JavaScript 175 148 139 135 7569 Bytes

Golfed:

<input id="E"value="C"onclick="thisvalue="c"onclick="this.select();document.execCommand('copy')"> 

Fiddle

Ungolfed

Got help from SitePoint

HTML:

<input style="display: none;" id="Empty" value="x"> <input id="clipclear" type="button" value="Clear The Clipboard"> 

JS:

function clearclip(){ empty=document.getElementById("Empty"); empty.style.display="block"; empty.select(); document.execCommand('copy'); empty.style.display="none"; } document.getElementById("clipclear").addEventListener("click", clearclip, false); 

JavaScript 175 148 139 135 75 Bytes

Golfed:

<input id="E"value="C"onclick="this.select();document.execCommand('copy')"> 

Ungolfed

Got help from SitePoint

HTML:

<input style="display: none;" id="Empty" value="x"> <input id="clipclear" type="button" value="Clear The Clipboard"> 

JS:

function clearclip(){ empty=document.getElementById("Empty"); empty.style.display="block"; empty.select(); document.execCommand('copy'); empty.style.display="none"; } document.getElementById("clipclear").addEventListener("click", clearclip, false); 

JavaScript 175 148 139 135 69 Bytes

Golfed:

<input value="c"onclick="this.select();document.execCommand('copy')"> 

Fiddle

Ungolfed

Got help from SitePoint

HTML:

<input style="display: none;" id="Empty" value="x"> <input id="clipclear" type="button" value="Clear The Clipboard"> 

JS:

function clearclip(){ empty=document.getElementById("Empty"); empty.style.display="block"; empty.select(); document.execCommand('copy'); empty.style.display="none"; } document.getElementById("clipclear").addEventListener("click", clearclip, false); 
Use inline onclick instead of event handler
Source Link
TecBrat
  • 222
  • 1
  • 9

JavaScript 175 148 139 135135 75 Bytes

Golfed:

HTML: 24 bytes

<input id="E" value="C"> 

JS: 151 124 115 111 bytes

e=document.getElementById("E");e.addEventListener("click",function(){eid="E"value="C"onclick="this.select();document.execCommand('copy');})"> 

Ungolfed

Got help from SitePoint

HTML:

<input style="display: none;" id="Empty" value="x"> <input id="clipclear" type="button" value="Clear The Clipboard"> 

JS:

function clearclip(){ empty=document.getElementById("Empty"); empty.style.display="block"; empty.select(); document.execCommand('copy'); empty.style.display="none"; } document.getElementById("clipclear").addEventListener("click", clearclip, false); 

JavaScript 175 148 139 135 Bytes

Golfed:

HTML: 24 bytes

<input id="E" value="C"> 

JS: 151 124 115 111 bytes

e=document.getElementById("E");e.addEventListener("click",function(){e.select();document.execCommand('copy');}) 

Ungolfed

Got help from SitePoint

HTML:

<input style="display: none;" id="Empty" value="x"> <input id="clipclear" type="button" value="Clear The Clipboard"> 

JS:

function clearclip(){ empty=document.getElementById("Empty"); empty.style.display="block"; empty.select(); document.execCommand('copy'); empty.style.display="none"; } document.getElementById("clipclear").addEventListener("click", clearclip, false); 

JavaScript 175 148 139 135 75 Bytes

Golfed:

<input id="E"value="C"onclick="this.select();document.execCommand('copy')"> 

Ungolfed

Got help from SitePoint

HTML:

<input style="display: none;" id="Empty" value="x"> <input id="clipclear" type="button" value="Clear The Clipboard"> 

JS:

function clearclip(){ empty=document.getElementById("Empty"); empty.style.display="block"; empty.select(); document.execCommand('copy'); empty.style.display="none"; } document.getElementById("clipclear").addEventListener("click", clearclip, false); 
Saved 2 more bytes
Source Link
TecBrat
  • 222
  • 1
  • 9
Loading
deleted 2 characters in body
Source Link
NoOneIsHere
  • 2.2k
  • 1
  • 23
  • 48
Loading
Improve Golf Score Again
Source Link
TecBrat
  • 222
  • 1
  • 9
Loading
Add Golfed Version
Source Link
TecBrat
  • 222
  • 1
  • 9
Loading
added 1 character in body
Source Link
TecBrat
  • 222
  • 1
  • 9
Loading
Source Link
TecBrat
  • 222
  • 1
  • 9
Loading