23 July 2017

JQuery: Click button Toggle

JQuery Click Toggle
JavaScript 2017
<!DOCTYPE html>
<html>
    <head>
        <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
        <script>
            $(document).ready(function () {
                $("button").click(function () {
                    $("p").toggle();
                });
            });
        </script>
    </head>
    <body>

        <button>Toggle between hiding and showing the paragraphs</button>

        <p>This is a paragraph with little content.</p>
        <p>This is another small paragraph.</p>

    </body>
</html>

0 nhận xét:

Post a Comment

 

BACK TO TOP

Xuống cuối trang