I am done with redirection to target page but what I want is to redirect to particular <div>
of the page. How can this be achieved?
Method 1: Using HTML: One can use the anchor tag to redirect to a particular section on the same page. You need to add ” id attribute” to the section you want to show and use the same id in href attribute with “#” in the anchor tag.
To redirect one HTML page to another page, you need to add a <meta> tag inside the <head> section of the old HTML page.
An <a> tag can also be used to mark a section of a web page as a target for another link to jump to. For example, this link will jump to the bottom of this page. If the "name" and "id" attribute is used, the <a> tag is an anchor, but if the "href" attribute is used then it is a link.
You can do it in two ways.
1) [via Javascript (+jQuery)]
<a href="#" id="home">home</a>
$('#home').click(function(){
$(document).scrollTop(100) // any value you need
});
2) [via pure HTML]
<a href="#home_section">home</a>
<section id="home_section"></section>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With