aspx Tutorial

.NET Articles,jQuery demo, asp.net with jQuery, online tutorial,Jquery, SilverLight, Javascript, asp.net,JSON, MVC,.NET Articles,demo, Web Services, .NET articles, Sharepoint 2010, visual studio 2010,Aamir Hasan,IT, Building Your First Web Application Project
Advertise Here

Toolbar

Get our toolbar!

Advertize



Posted by Aamir Hasan   on Tuesday, November 29, 2011 Total Views:  

In this example, you will see how to get iframe contents with jquery. When user click on button iframe body content will display on message box.

Here’s is an example

<html xmlns="http://www.w3.org/1999/xhtml">

<head runat="server">

    <title></title>

    <script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.7.1.min.js" type="text/javascript"></script>

    <script type="text/javascript">

        $(function(){

            $("input[type='button'][id$='Button1']").click(function(){

                var htmlsr = $("#iframe1").contents().find("body").html();

                alert(htmlsr);

            });

        });

</script>

</head>

<body>

    <form id="form1" runat="server">

    <div>

        <input id="Button1" type="button" value="Click"/><br/>

        <iframeid="iframe1"src="iframe1.html"/>

    </div>

    </form>

</body>

</html>

Note: This example will not work on cross-domain.

Output

Download

Iframe-content1.zip (1.13 kb)

See live demo

Category: All | asp.net | HTML | jQuery
Protected by Copyscape Online Plagiarism Tool

Comments (3) -

lucas
lucas Peru
11/9/2012 1:06:24 PM #

hola una consulta como hago para que el resultado me muestro en un textbox en asp

Israel Riberdy
Israel Riberdy United States
9/20/2013 3:58:28 AM #

Hello! Someone in my Myspace group shared this website with us so I came to look it over. I'm definitely enjoying the information. I'm book-marking and will be tweeting this to my followers! Wonderful blog and terrific style and design.|

Lyndsey Sabatino
Lyndsey Sabatino United States
9/24/2013 10:01:32 AM #

Horrible site you've got at this juncture. The item hard to uncover high-quality entering like yours currently. I really increase in value singles like you

Asian Restaurant Supply
Asian Restaurant Supply United States
10/15/2013 3:57:35 PM #

I constantly spent my half an hour to read this web site's content daily along with a cup of coffee.|

Add comment

  Country flag

biuquote
  • Comment
  • Preview
Loading

Advertizement 1
Advertizement 2
Advertizement 3
Advertizement 4
Advertizement 5