0

I'm learning HTML. I've following code piece:

<a href="#B" id="specialClass" class="primary-btn icon-cart" data-one="#A" data-five="google.com" data-ten="#C" target="_blank">
    <span id="pressButton">New Button</span>
</a>

When I press button based on slider and data-five gets triggered, I for some reason open in a new tab mywebsite.com/google.com instead of google.com.

What am I doing wrong?

1
  • Please also include whatever JS is handling your data attributes. As is, the link should send you to mywebsite.com#B. Commented May 17, 2022 at 14:06

1 Answer 1

1

If it is an address outside your web page you have to put the full path with https://google.es <a target="_blank" href="https://google.es">Google</a>

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks, that was silly from my side, lol.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.