We are providing online training of realtime Live project on Asp.Net MVC with Angular and Web API. For more information click here. If you have any query then drop the messase in CONTACT FORM

Monday, June 22, 2015

Create divisions and Click a button then display all division in Jquery

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <style type="text/css">
        .class1 {
            border: 5px solid green;
            padding: 5px;
            margin: 5px;
        }
    </style>
    <script src="Scripts/jquery-2.1.1.js">   
    </script>
    <script type="text/javascript">
        $(document).ready(function(){
            $("#btn").click(function () {
                var content = "";
                $("div.class1").each(function () {
                    content += $(this).html() + "\n";
                });
                alert(content);
            });
        });       

    </script>
</head>
<body>
    <form id="form1" runat="server">
        <input type="button" id="btn" value="Show the content" />
        <br />
    <div>
        <div class="class1" >
            This is dive1 content
            </div>
        <div class="class1">
            This  is dive2 content
        </div>
        <div class="class1">
            This is dive3 content
        </div>  

    </div>     

    </form>
</body>

</html>
Output:

No comments: