HTML में anchor सबसे important role play करता है। anchor tag hyperlink define करता है जिसका main purpose किसी page को दुसरे web page के साथ link करना है।


For Example हमारी website में left side में जो topic list और header में जो courses link दी गयी है वे सभी hyperlink ही हैं , जिनकी जिनकी help से हम दुसरे page पर जा पाते हैं।


anchor tag को <a href="location">link name</a> से define करते हैं जिसमे href attribute में ही हम use page की location (path) define करते हैं जिसे हमें link करना होता है।

HTML <a> Example

<a href="/js/javascript-introduction-in-hindi">JavaScript Introduction In Hindi</a>

Output :
JavaScript Introduction In Hindi

Important
अगर href attribute blank छोड़ दिया means आपने उसमे किसी भी page की location नहीं दी तो वह link current page को ही link कर देगी।

<a href="">Click Here</a>
Output :
Click Here

HTML target attribute

अब अगर आप चाहते हैं कि नया page जो कि link se connected है वो new tab में open हो तो उसके लिए target attribute का use करते हैं। इसे target ="_blank" लिखते हैं। लेकिन यह ध्यान रहे कि target attribute हमेशा href attribute के साथ ही use होगा।
For Example

<a href="/jquery/jquery-introduction-in-hindi" target="_blank">JavaScript Introduction In Hindi</a>

//open current page in new tab
<a href="" target="_blank">Click Here</a>

Output :
jQuery Introduction In Hindi
Click Here

HTML empty link

अगर आप <a> tag में href attribute में javascript:void() use करते हैं तो उसे link void link या empty link कहते हैं। ऐसी links पर click करने पर कुछ भी नहीं होता है।
For Example

<a href="javascript:void()">Click Here</a>

Output :
Click Here

Related Topics :

Rahul Kumar

Rahul Kumar

Hi ! I'm Rahul Kumar Rajput founder of learnhindituts.com. I'm a software developer having more than 4 years of experience. I love to talk about programming as well as writing technical tutorials and blogs that can help to others. I'm here to help you navigate the coding cosmos and turn your ideas into reality, keep coding, keep learning :)

Get connected with me. :) LinkedIn Twitter Instagram Facebook

b2eprogrammers