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

Applying an ID to a Window created via JavaScript

3 Answers 168 Views
Window
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Matt
Top achievements
Rank 1
Matt asked on 16 Jul 2011, 08:32 PM
Hi all,

Is there a way to apply an ID to the Window when it is being created in JavaScript?  I would like to reference the Window using JQuery  like $('WindowID'), but can't seem to be able to assign an ID to the Window.  Using firebug to inspect it also confirms that the <div> tag it belongs to does not have an ID.

Note, that when I create the Window using Razor syntax, I am able to apply a Name to the Window that I can later use to reference the Window (and resize it, close it, re-open it, etc).

Thanks in advance for any help!

3 Answers, 1 is accepted

Sort by
0
mark
Top achievements
Rank 1
answered on 26 Jul 2011, 01:04 PM
I have the same need.  Any help would be appreciated.  Thanks.
0
Matt
Top achievements
Rank 1
answered on 03 Aug 2011, 09:50 PM
Nobody else has this need?  Is this possible at all?
0
Matt
Top achievements
Rank 1
answered on 04 Aug 2011, 03:39 PM
Ok ... I was able to figure this out ...

After creating your window (like this):
var windowElement = $.telerik.window.create({
            title: "Window opened from JS",
            html: "<strong>Inserting an image from JS only (no razor)...</strong>",
            contentUrl: '',
            modal: false,
            resizable: false,
            draggable: true,
            scrollable: false,
            width: 150,
            onClose: function () { console.log('closed'); }
        })

You can apply an ID attribute to the window using the jQuery method .attr() (like this):
windowElement.attr('id', 'myChatID');
Tags
Window
Asked by
Matt
Top achievements
Rank 1
Answers by
mark
Top achievements
Rank 1
Matt
Top achievements
Rank 1
Share this question
or