Wednesday, 9 August 2017

Jquery class selector

You can select a HTML tag with its class name which is used by tag. When you know class name then you can add custom HTML from a function of java script using jquery class selector.

<html>
<head>
    <title>Girfa Student Help</title>
    <script src="https://ajax.aspnetcdn.com/ajax/jQuery/jquery-3.2.1.min.js"></script>
    <style>
        .para
        {
            text-align:center;

            margin:20px;
        }
    </style>

    <script>
        $(document).ready(function () {
            $("button").click(function () {
                $(".para").html("<h2>Jquery Class Changer</h3><hr><br>You can change content of container by class name.Jquery find class through out find the tag and change its content accordingly");
            });
        });
    </script>

</head>
<body>
    <button>Get Data</button><br />
    <p class="para">

    </p>
</body>

</html>






No comments:

Post a Comment