Cv / Neo.html
Pezh's picture
Create Neo.html
a75f50b verified
<!DOCTYPE html>
<html>
<head>
<style>
body {
font-family: Arial, sans-serif;
}
.container {
max-width: 600px;
margin: 20px auto;
padding: 20px;
border: 1px solid #ccc;
border-radius: 5px;
}
input[type="text"] {
width: 100%;
padding: 10px;
margin: 10px 0;
}
input[type="checkbox"] {
margin-right: 10px;
}
.result {
margin-top: 20px;
}
button {
padding: 10px 20px;
background-color: #4CAF50;
color: white;
border: none;
border-radius: 5px;
cursor: pointer;
}
button:hover {
background-color: #45a049;
}
</style>
</head>
<body>
<div class="container">
<input type="text" id="textInput" placeholder="Enter text with ❒ separated words">
<button onclick="createCheckboxes()">Create Checkboxes</button>
<div id="checkboxContainer"></div>
<button onclick="showResult()">Result</button>
<input type="text" id="resultInput">
</div>
<script>
function createCheckboxes() {
var text = document.getElementById("textInput").value;
var words = text.split("❒");
var checkboxContainer = document.getElementById("checkboxContainer");
checkboxContainer.innerHTML = "";
words.forEach(function(word) {
if (word.trim() !== "") {
var label = document.createElement("label");
var checkbox = document.createElement("input");
checkbox.type = "checkbox";
checkbox.value = word.trim();
label.appendChild(checkbox);
label.appendChild(document.createTextNode(word.trim()));
checkboxContainer.appendChild(label);
}
});
}
function showResult() {
var checkboxes = document.querySelectorAll("#checkboxContainer input[type='checkbox']");
var result = [];
checkboxes.forEach(function(checkbox) {
if (checkbox.checked) {
result.push(checkbox.value);
}
});
document.getElementById("resultInput").value = result.join(", ");
}
</script>
</body>
</html>