Introduction:
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.
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.
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
|
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. |
|||
|
|||
0 comments :
Note: Only a member of this blog may post a comment.