This is a migrated thread and some comments may be shown as answers.

How to append <div> in my kendoWindow from parent window?

2 Answers 807 Views
Window
This is a migrated thread and some comments may be shown as answers.
Warren
Top achievements
Rank 2
Warren asked on 13 Mar 2013, 09:34 PM
Hey Guys,

I am creating and opening a kendoWindow with the iframe property set to true which loads "chat.html" in the content. What I am trying to do is append a <div> inside the kendoWindow from the parent. On the parent page I can locate the window using  var wnd = $("#window").data("kendoWindow"); just not sure how to append a div inside my kendoWindow using jQuery.

// Simply returns the <iframe> html
$("#window").html();

// This code doesn't append the div
$("#window #divTest").append("Some text");

Can anybody guide me in the right direction?

Thank You

2 Answers, 1 is accepted

Sort by
0
Dimo
Telerik team
answered on 14 Mar 2013, 12:12 PM
Hello Warren,

Elements can be appended to the Kendo UI Window iframe in the same way as they are appended to a regular iframe. The iframe must be showing a page from the same domain and you need to obtain a reference to the iframe's documentElement object.

https://www.google.com/search?q=append+element+to+iframe

https://developer.mozilla.org/en-US/docs/HTML/Element/iframe
(see section Scripting)

The Kendo UI Window iframe element can be obtained via

windowObject.element.children(".k-content-frame")
or
windowObject.wrapper.find(".k-content-frame")
or
$("#windowID").children(".k-content-frame")

Greetings,
Dimo
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Warren
Top achievements
Rank 2
answered on 14 Mar 2013, 01:28 PM
Thank you, thank you, thank you Dimo!

Was able to get down to the div and append using:
$("#window").children(".k-content-frame").contents().find("#divTest").append("Some text");
Tags
Window
Asked by
Warren
Top achievements
Rank 2
Answers by
Dimo
Telerik team
Warren
Top achievements
Rank 2
Share this question
or