Your code is kind of overkill.
- .live() is deprecated in jQuery 1.7 and totally removed in 1.9, jquery documentation says you should use .on() instead.
- Everything is simple. You can try something like:
$('.draggable').click(function(){ var $element = $(this).children(); var width = parseInt($element.width()); var height = parseInt($element.height()); var placeholder = $element.attr('placeholder'); alert(placeholder+ " " +width+ " " +height); })
- .children() method normally return set of element's children but there are only one in your example, so it's ok.
- .width() and .height() returns values like "300px", so we use parseInt() to make int values.
- .click(handler) is a shortcut for .on( "click", handler )