One of the most powerful things of jQuery is to select any item on a page like this:
$(".block").css("border","3px solid red");
How can I also get the values of the selected items like width height and top left offset?
One of the most powerful things of jQuery is to select any item on a page like this:
$(".block").css("border","3px solid red");
How can I also get the values of the selected items like width height and top left offset?
Use width, height and position or offset:
var elem = $(".block");
var elemWidth = elem.width();
var elemHeight = elem.height();
var elemPosition = elem.position();
var elemOffset = elem.offset();
For further questions, first take a look into the jQuery documentation.
Try this:
$(".block").css("border","3px solid red").offset().top
$(".block").css("border","3px solid red").offset().left
CSS/offset() in JQuery