How to Make Automatic Text as Clickable on Website

Make your table’s text as clickable like link. Use our simple code on your website then make it easy. If you any any multimedia type of website then this code more helpful for you.

How to Do

  • Open post’s table and add id for which word to change automatically as link.
id="findmoreSinger"
  • then use given JavaScript code on <head> or <footer> section.
<script>
document.addEventListener('DOMContentLoaded', function() {
const findmoreSinger = document.getElementById('findmoreSinger');
const singers = findmoreSinger.innerText.split(', ');
findmoreSinger.innerHTML = ''; // Clear previous content
singers.forEach((item, index) => {
const link = document.createElement('a');
link.href = `https://yourwebsiteurl/?s=${encodeURIComponent(item)}`;
link.target = '_self';
link.textContent = item;
findmoreSinger.appendChild(link);
if (index < singers.length - 1) {
findmoreSinger.appendChild(document.createTextNode(', '));
}
});
});
</script>
  • Then SAVE it.

You can change both id name and site url for search. Hope this code will work on your project. Thanks for visiting.

Watch Video for One Time


for Multiple time

example id for one filed id=”findmoreSinger”, another like – findmorePerformed, findmoreMusic.

code

<script>
document.addEventListener('DOMContentLoaded', function() {
const idsToProcess = ['findmoreSinger', 'findmorePerformed', 'findmoreLyrics', 'findmoreMusic']; // Add all the IDs you want to process
idsToProcess.forEach(id => {
const element = document.getElementById(id);
if (element) {
const items = element.innerText.split(', ');
element.innerHTML = ''; // Clear previous content
items.forEach((item, index) => {
const link = document.createElement('a');
link.href = `https://www.domain.com/?s=${encodeURIComponent(item)}`;
link.target = '_self';
link.textContent = item;
element.appendChild(link);
if (index < items.length - 1) {
element.appendChild(document.createTextNode(', '));
}
});
}
});
});
</script>

Watch Video for Multiple Filed