To resolve the issue flagged by Google and Hubspot SEO tools, you need to ensure that all the links on your webpage are using proper <a> tags with an href attribute.
JavaScript-Generated Links: If you are using JavaScript to create links dynamically, consider replacing them with proper <a> tags, or make sure to include href attributes dynamically.
// Instead of
document.getElementById("link").innerHTML = "Link";
// Use
document.getElementById("link").innerHTML = "Link";
Buttons as Links: If you're using <button> or <span> elements as clickable items that navigate to other pages, replace them with <a> tags.
// Instead ofdocument.getElementById("link").innerHTML = "<span onclick='goToPage()'>Link</span>";// Usedocument.getElementById("link").innerHTML = "<a href='/some-page'>Link</a>";
Missing href Attributes: Ensure all <a> tags have a valid href attribute.
<!-- Incorrect --><a id="hubspot" data-hs-anchor="true">Link</a><!-- Correct --><a href="/some-page" id="hubspot" data-hs-anchor="true">Link</a>
Hash Links: If you're using anchor tags for on-page navigation, still include the href attribute with a hash (#).
<!-- Instead of --><a id="section-link" data-hs-anchor="true">Section</a><!-- Use --><a href="#section" id="section-link" data-hs-anchor="true">Section</a>
Complex Data Attributes: If you are using data attributes like data-hs-anchor="true", it's okay to keep them as long as you also include an href.
<!-- Correct --><a href="/some-page" id="hubspot" data-hs-anchor="true">Link</a>
By following these guidelines, you should be able to resolve the issues highlighted by the SEO tools.