0

HELLPP Create links with the same number of the section

I have a navbar and a section that I want to link the navbar with each section when I click on it in the navbar how I can do that with JAVASCRIPT

21st Sep 2020, 7:35 PM
Marina Magdy Girgis
1 Odpowiedź
+ 4
Hi Marina Magdy Why would you want to do that with JavaScript? Anyways, here you go In the HTML <section Id="content"> Stuff in the section </section> <!--This <a> tag is inside the navbar--> <a id|"Link_to_secrion"> Click me to go to section </a> In the JS document.getElementById("Link_to_section").href = "#" + document.getElementById("content").id; Normally you could have done this with noJavaScript like so In the HTML <section Id="content"> Stuff in the section </section> <!--This a tag is inside the navbar--> <a id|"Link_to_setrion" href= "#content" > Click me to go to section </a>
21st Sep 2020, 9:27 PM
Vachila64☕
Vachila64☕ - avatar