Posted 22 Feb 2010 Link to this post
Posted 25 Feb 2010 Link to this post
This is expected behavior, because the $(expression, [context] ) jQuery function will not return an HTML element and the dock's set_handle(element) accepts an HTML element as parameter. Try the following code that searches for elements with id="Handle_1", stores the result in var d and alerts d.id and d[0].id. Notice that d.id will alert "undefined" and d[0].id "Handle_1". Basically, if you want to set the dock handle to the element with id="Handle_1" you need to use dock.set_handle(d[0]). <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head id="Head1" runat="server"> <title></title> <script type="text/javascript"> function SetDockHandle() { var d = $("#Handle_1"); alert(d.id); alert(d[0].id); } </script> </head> <body> <form id="form1" runat="server"> <div> <asp:ScriptManager ID="scriptmanager1" runat="server"> <Scripts> <asp:ScriptReference Path="~/jquery-1.4.2.js" /> </Scripts> </asp:ScriptManager> <input type="button" onclick="SetDockHandle(); return false;" value="Get element ID" /> <div id="Handle_1"> </div> </div> </form> </body> </html>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<
html
xmlns
=
"http://www.w3.org/1999/xhtml"
>
head
id
"Head1"
runat
"server"
title
></
script
type
"text/javascript"
function SetDockHandle()
{
var d = $("#Handle_1");
alert(d.id);
alert(d[0].id);
}
</
body
form
"form1"
div
asp:ScriptManager
ID
"scriptmanager1"
Scripts
asp:ScriptReference
Path
"~/jquery-1.4.2.js"
/>
input
"button"
onclick
"SetDockHandle(); return false;"
value
"Get element ID"
"Handle_1"
Posted 26 Feb 2010 Link to this post