Skip to content Skip to sidebar Skip to footer

Adding Hyperlink In Javascript Array Of Objects

I have an array of objects and within each object there is an answers section, but I need to hyperlink some certain words that should send the user to a website. I have given an e

Solution 1:

Just surround the word with anchor tag . Like this and give url after //

<ahref="//www.google.com">London</a>

Solution 2:

Try this one. You can put your link instead of https://www.google.com. This will create hyperlink for word 'London'

<script>functionmyFunction() {
            var result = "The capital is" + "London".link("https://www.google.com");
            document.getElementById("demo").innerHTML = result;
        }
        </script>

Post a Comment for "Adding Hyperlink In Javascript Array Of Objects"