How to create anchor tag using jquery

Create anchor tag using jquery

By Yashwant Chavan, Views 20255, Date 06-Oct-2015

In this jquery tutorial, I will help you how to create HTML tag / element using Jquery. Here I have created simple anchor tag (link) using Jquery DOM element API.

tags jquery

Jquery Dynamic anchor tag

In below example I have created simple link (anchor tag) which is pointed to along with its different properties like attributes, text, class etc. Once the link is form we will add it to div element.

<!DOCTYPE html>

    <script src=""></script>
        $(document).ready(function() {
            $('#btn').click(function() {

                var link = $("<a>");
                link.attr("href", "");
                link.attr("title", "");


    p {
        margin: 10px;
        font-weight: bold;
    .link {
        color: red;
        font-size: 25px;
        font-weight: bold;
        text-decoration-style: solid;
        margin: 10px;

    <h1>Jquery Show Hide </h1>
    <div class="box" id="box"></div>
    <p><input type="button" id="btn" value="Create Link"></p>



Create anchor tag using jquery


Hi there! I am founder of and programming enthusiast. My skills includes Java,J2EE, Spring Framework, Nodejs, PHP and lot more. If you have any idea that you would want me to develop? Lets connect: yashwantchavan[at][]