Introduction:
Description:
In previous articles I explained Redirect to another page after some time delay, jQuery slideUp slideDown toggle effects, jQuery Drag and Drop Example, and many articles relating to JQuery. Now I will explain how to get div id value or div content using jQuery in asp.net.
In previous articles I explained Redirect to another page after some time delay, jQuery slideUp slideDown toggle effects, jQuery Drag and Drop Example, and many articles relating to JQuery. Now I will explain how to get div id value or div content using jQuery in asp.net.
Get
div id or div content
<script type="text/javascript">
$(document).ready(function()
{
$('#btnClick').click(function() {
var divtxt = $('#contentdiv').html();
alert(divtxt);
})
});
</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 jQuery</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js">
</script>
<script type="text/javascript">
$(document).ready(function()
{
$('#btnClick').click(function() {
var divtxt = $('#contentdiv').html();
alert(divtxt);
})
});
</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" />
</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. |
|||
|
|||
2 comments :
i cant download the coding please help me..........
hello sir thanks for Ur article could u tel me
can we save the div as image in server using Jquery ajax if so is there any sample code
can u help me in this
Note: Only a member of this blog may post a comment.