Aspdotnet-Suresh

aspdotnet-suresh offers C#.net articles and tutorials,csharp dot net,asp.net articles and tutorials,VB.NET Articles,Gridview articles,code examples of asp.net 2.0 /3.5,AJAX,SQL Server Articles,examples of .net technologies

JavaScript- Get Div Id Value or Content in Asp.net

Oct 22, 2012
Introduction

Here I will explain how to get div id value or div content using
JavaScript in asp.net.

Description:
  
In previous articles I explained
Redirect to another page after some time delay, jQuery Remove first/last character from string, jQuery Drag and Drop Example,  and many articles relating to JavaScript and JQuery. Now I will explain how to get div id value or div content using JavaScript in asp.net.

To get div id value or div content we need to write CodeSnippet like as shown below

Get div id or div content


<script type="text/javascript">
function Getdivdata() {
var div = document.getElementById('contentdiv');
alert(div.innerHTML);
}
</script>
If you want check this code in sample check below code

Example:


<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Get div id or content in javascript</title>
<script type="text/javascript">
function Getdivdata() {
var div = document.getElementById('contentdiv');
alert(div.innerHTML);
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div id="contentdiv">Welcome to Aspdotnet-Suresh.com</div>
<br />
<input type="button" id="btnClick" value="Get Div Content" onclick="JavaScript:Getdivdata()" />
</form>
</body>
</html>
Live Demo

To check Live demo click on below button

Welcome to Aspdotnet-Suresh.com


If you enjoyed this post, please support the blog below. It's FREE!

Get the latest Asp.net, C#.net, VB.NET, jQuery, Plugins & Code Snippets for FREE by subscribing to our Facebook, Twitter, RSS feed, or by email.

subscribe by rss Subscribe by RSS subscribe by email Subscribe by Email

0 comments :

Give your Valuable Comments

Other Related Posts

© 2015 Aspdotnet-Suresh.com. All Rights Reserved.
The content is copyrighted to Suresh Dasari and may not be reproduced on other websites without permission from the owner.