Find element ID: Expression Expected Error
I'm having issues when trying to run my web app. I'm getting an expression expected error at runtime on the portion of my code that is designed to retain the screen position of multiple drag panels.
Code:
var target = $this).attr("id");
should return the id of the uniquely named panel so it can be used later in code to identify the _DragPanelExtender.BehaviorID
Code:
$find('<%=' + target + '_DragPanelExtender.BehaviorID%>').set_location(new Sys.UI.Point(parseInt(temp[0]), parseInt(temp[1])));
I haven't been able to verify if the dragPanel's id name is being used, it just errors out here. Can anyone help with the following code, where I am attempting to preserve the position of multiple dragPanel's after postback? Thanks.
Code:
function pageLoad() {
//get element id name of button clicked
var target = $(this).attr("id");
// call the savePanelPosition when the panel is moved
$find(target).add_move(savePanelPosition);
var elem = $get("<%=HiddenField1.ClientID%>");
if (elem.value != "0") {
var temp = new Array();
temp = elem.value.split(';');
// set the position of the panel manually with the retrieve value
$find('<%=' + target + '_DragPanelExtender.BehaviorID%>').set_location(new Sys.UI.Point(parseInt(temp[0]), parseInt(temp[1])));
}
}
function savePanelPosition() {
//get element id name of button clicked
var target = $(this).attr("id");
var elem = $find(target).get_element();
var loc = $common.getLocation(elem);
var elem1 = $get("<%=HiddenField1.ClientID%>");
// store the value in the hidden field
elem1.value = loc.x + ';' + loc.y;
}
Re: Find element ID: Expression Expected Error
Looks like you forgot one parenthesis:
Change this:
var target = $this).attr("id");
to this
var target = $(this).attr("id");
Re: Find element ID: Expression Expected Error
I forgot the parenthesis in the beginning portion of the post where I was explaining the problem. Sorry for the confustion. The entire code snippet, cut and pasted from the origninal, shows the parenthesis is there.