Can we make an anchor without <a> tag?

Hi, i just want to know if we can do an anchor without using an “a” tag. I mean if we did an id on some tag, can we just make a “href” for this id on tags like “p”.
https://www.codecademy.com/paths/web-development/tracks/learn-html-web-dev-path/modules/learn-html-elements/lessons/html-document-standards/exercises/linking-same-page-html

Not all attributes are valid for all elements. Elements like the anchor element where made for a purpose.

1 Like

Well, if you do need to do linking without anchor tag then, you can use href attribute and assign a click event using JavaScript.

When, the tag is clicked on, use JavaScript to get the href and use window.location to send the user to the url (mention in the href)

You may also, change cursor to pointer using css so that, it looks like a link to the user.

1 Like