<!DOCTYPE html>
<html>
<head>
<title>Hashtag Generator</title>
</head>
<body>
<h1>Hashtag Generator</h1>
<style>
textarea {
width: 500px;
height: 300px;
}
</style>
<textarea id="textInput">
</textarea><br>
<button id="generateBtn">Generate Hashtags</button>
<button id="clearBtn">Clear</button><br><br>
<p id="hashtags"></p>
<script>
const generateBtn = document.querySelector("#generateBtn");
const clearBtn = document.querySelector("#clearBtn");
const textInput = document.querySelector("#textInput");
const hashtags = document.querySelector("#hashtags");
generateBtn.addEventListener("click", function() {
const words = textInput.value.trim().split(" ");
let generatedHashtags = "";
for (const word of words) {
if (word.startsWith("#")) {
generatedHashtags += ` ${word}`;
} else {
generatedHashtags += ` #${word}`;
}
}
hashtags.textContent = generatedHashtags;
});
clearBtn.addEventListener("click", function() {
textInput.value = "";
hashtags.textContent = "";
});
</script>
</body>
</html>
- RiteTag
- Keyhole
- Hashtagify
- All Hashtag
- Tagboard
0 Comments