<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:
Post a Comment