varparametersJson={"size":250,// Size of Qr Code"backgroundColor":"38-38-38",// Background Color Of Qr Code (In RGB)"qrColor":"255-255-255",// Color of Qr Code (In RGB)"padding":2,// Padding "data":"dev.to"};varparameters;varbtn=document.querySelector("button");varimg=document.querySelector("img");varinput=document.querySelector("input");btn.addEventListener("click",function(){parametersJson.data=input.value||"dev.to";parameters=`size=${parametersJson.size}&bgcolor=${parametersJson.backgroundColor}&color=${parametersJson.qrColor}&qzone=${parametersJson.padding}&data=${parametersJson.data}`// Stitch Together all Paramentersimg.src=`https://api.qrserver.com/v1/create-qr-code/?${parameters}`// Set Image URL To Link});
Top comments (2)
Good One!
nice one