html
html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>
<div>Barcode Generator</div>
<input type="text" placeholder="Type..." />
<button onclick="generate()">Generate Barcode</button>
<svg id="barcode"></svg>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jsbarcode/3.11.0/JsBarcode.all.min.js"></script>
<script>
JsBarcode("#barcode","Hello!",{
background: "#161748",
lineColor: "#ffffff"
});
function generate(){
let val = document.querySelector("input").value
if(val == ""){
val="Hello!"
}
JsBarcode("#barcode", val ,{
background:"#161748",
lineColor: "#ffffff"
});
Enter to Rename, Shift+Enter to Preview
css
css
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
body {
margin:0;
padding:0;
background-color: #161748;
}
div{
width:100%;
text-align:center ;
margin-top:20px;
font-weight:800;
font-size:33px;
color: white;
}
input{
padding:8px 4px 8px 4px;
font-size:16px;
border:none;
background-color:transparent ;
color: #fff;
border-bottom:1px solid #448aff;
display:block;
margin-left:auto;
margin-right:auto;
margin-top:50px;
margin-bottom:30px;
outline:none;
}
button{
Enter to Rename, Shift+Enter to Preview
js
js
1
Enter to Rename, Shift+Enter to Preview
BROWSER
Console
Run