Last anchor tag not getting added properly with jQuery append method

A less messy-looking option is using template strings:

var a = `<a href="${value.webLink}">${value.linkText}</a>`

Also not that you shouldn’t use <br> there. Semantically it would make way more sense to have the HTML be

<div class="dropdown">
    <button class="dropbtn">Quick Links</button>
    <ul class="dropdown-content">
        <li><a href="http:/example1.com/home">Example 1</a></li>
        <li><a href="https://www.example2.com">Example 2</a></li>
        <li><a href="https://www.example3.com">Example 3</a></li>
        <li><a href="https://example4.com">Example 4</a></li>
    </ul>
</div>

and let CSS do the formatting (=> display)–even if you don’t use the list approach.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.