YouTube Title Generator

🎬

YouTube Title Generator

Enter your topic and get 5 click-worthy titles

'; topicInput.focus(); return; } var topic = capitalize(rawTopic); var style = styleSelect.value; var addYear = yearCheck.checked; var addEmoji = emojiCheck.checked; btn.disabled = true; btn.innerHTML = ' Generating...'; setTimeout(function() { var pool = templates[style] || templates.General; var shuffled = pool.slice().sort(function() { return Math.random() - 0.5; }); var chosen = shuffled.slice(0, 5); var html = ''; chosen.forEach(function(t, i) { var title = buildTitle(t, topic, addYear, addEmoji); html += '
' + '' + (i + 1) + '. ' + title + '' + '' + '
'; }); resultsBox.innerHTML = html; btn.disabled = false; btn.innerHTML = ' Generate Titles'; attachCopyHandlers(); }, 500); } function attachCopyHandlers() { var copyBtns = resultsBox.querySelectorAll('.pg-copy-btn'); copyBtns.forEach(function(b) { b.addEventListener('click', function() { var text = b.getAttribute('data-title'); navigator.clipboard.writeText(text).then(function() { var original = b.textContent; b.textContent = 'Copied!'; b.classList.add('copied'); setTimeout(function() { b.textContent = original; b.classList.remove('copied'); }, 1500); }); }); }); } btn.addEventListener('click', generateTitles); topicInput.addEventListener('keypress', function(e) { if (e.key === 'Enter') generateTitles(); }); })();
Scroll to Top