aspx Tutorial

NET Articles,jQuery demo, asp.net with jQuery, online tutorial,Jquery, SilverLight, Javascript, asp.net,JSON, MVC,.NET Articles,demo, Web Services,
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 (1) -

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

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

Add comment

  Country flag

biuquote
  • Comment
  • Preview
Loading

Advertizement 1
Advertizement 2
Advertizement 3
Advertizement 4
Advertizement 5