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

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

Oct 22, 2012
Introduction

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

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.

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">
$(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


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

2 comments :

shalinirajapandy said...

i cant download the coding please help me..........

Unknown said...

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

Give your Valuable Comments

Note: Only a member of this blog may post a comment.

© 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.