views:

197

answers:

2

I am using jquery in my php web page. I want to find the location of a textbox or button in a page. Please give me a sample jquery to find this. Please provide with any suggestions u have. Thanks in advance.

+2  A: 

See jQuery Offset. It get the current offset of the matched element, in pixels, relative to the document.

var textbox = jQuery("#element");
var offset = textbox.offset();
console.log("left: " + offset.left + ", top: " + offset.top );

See also: selector/text and selector/button

Use Firebug. It also add a global variable named "console" to all web pages loaded in Firefox. In this case "console.log" writes a message to the console.

ranonE
+1  A: 

See positioning into jQuery API CSS page