I'm using the following code with the script attached as a file to a page.
For whatever reasons it keeps showing the coordinates of the Save button as 0, 0 even though the button is in a middle of the page.
It finds the button, so it alerts 'Save' and everything.
function findButtonSides() {
saveButton = findButtonByValue(saveButtonValue);
var sb = $(saveButton);
var position = sb.position();
alert(position.left + ', ' + position.top);
}
function findButtonByValue(buttonValue) {
var aButton = document.getElementsByTagName("input");
var returnElement
for (i = 0; i < aButton.length; i++) {
var b = aButton[i];
if (b.value == buttonValue) {
alert(b.value);
return b;
}
}
}