forum

Home / DeveloperSection / Forums / Retrieve original image length & height with jquery?

Retrieve original image length & height with jquery?

Anonymous User 1858 30-Jan-2015

I have a display thumbnail at 250px by 250px. I want to be able to retrieve its original width and height when clicking on the thumbnail.

I tried doing this:

$(function() {
    $(".img_section").on('click',function() {
        var img = $(this).children(".test_img").attr("src");
        theImg.src =img.attr("src");
 
        var imgNaturalWidth = theImg.width();
        var imgNaturalHeight = theImg.height();
 
        alert(imgNaturalWidth);
        alert(imgNaturalHeight);
}) // not working

Any help will be appreciated, thanks.


Updated on 30-Jan-2015
I am a content writter !

Can you answer this question?


Answer

1 Answers

Liked By