Blatantly wrong accepted answer 4 Answers

Like this one for example...

How to get image size (height & width) using JavaScript?

the answer should just be removed.

  • You haven't link any answer. There are 20 answers. Which one are you referring?
    – Himanshu
    Commented Oct 12, 2013 at 4:32
  • 1
    Downvote and leave a comment. That's all you can do.
    – Mysticial
    Commented Oct 12, 2013 at 4:32
  • 2
    @hims056, There is only one marked as correct
    – Octopus
    Commented Oct 12, 2013 at 4:34
  • 2
    The question's phrasing, "dimensions of an image on the page", is a little bit ambiguous and could be interpreted as asking for what the accepted answer provides.
    – Jeremy
    Commented Oct 12, 2013 at 4:36
  • 2
    @Octopus - You haven't specified that you are talking about the accepted answer. Popular != accepted.
    – Himanshu
    Commented Oct 12, 2013 at 4:36
  • @hims056: What should happen with popular 'accepted' answers that just aren't right? Commented Oct 12, 2013 at 4:40
  • 2
    @øAmalMurali - meta.stackoverflow.com/posts/200460/revisions
    – Himanshu
    Commented Oct 12, 2013 at 4:40
  • 2
    @hims056: I didn't see the 'edited X mins ago' thing. Sorry :( Commented Oct 12, 2013 at 4:49
  • 1
    @Octopus - I disagree with your premise, but your second comment on the accepted answer (regarding image.naturalWidth) is good information. You should post that (with more details) as an answer. In time, it may rise to the top.
    – Tim M.
    Commented Oct 12, 2013 at 5:02
  • @TimMedora accepted answer will always be in the top
    – Michael
    Commented Oct 12, 2013 at 6:41
  • @Michael - true but clearly most people check more than just the first answer, as evidenced by how many upvotes the second answer has. My guess (could be validated by writing a query) is that the top 4-8 answers usually get significant views/votes. That's what I meant by "top".
    – Tim M.
    Commented Oct 12, 2013 at 6:46

3 Answers 3


The OP asked:

Are there any JavaScript or jQuery APIs or methods to get the dimensions of an image on the page?

"an image on the page"

It's not 100% clear if that means the file's dimensions or the rendered image. It is clear that the accepted answer did what the OP wanted and has helped many others.

Your comment:

This is SO NOT the right answer. I have display:none and of course it tells me the dimensions are 0,0.

So in other words, the image is not "on the page".

The correct answer is to use img.naturalWidth and img.naturalHeight

Then go upvote one of those answers.

To say "the answer should just be removed" is far too drastic. That's why we have a voting and comment system.

  • Agreed, this is the beauty of the voting/comment system. There is plenty of context around which of the answers (to an ambiguous question) is applicable to a particular need.
    – Tim M.
    Commented Oct 12, 2013 at 4:58
  • 1
    Well yeah and there's about 20 billion other posts on SO that "should be removed", why pick on one that's actually useful? Close vote queue is ridiculous, close to 90K.
    – user159834
    Commented Oct 12, 2013 at 5:01
  • Well I guess I have a pretty different POV then, but Ive never equated a img DOM element that holds an image with the image itself. A 500px is still 500px even if it appears to be 200px on a page. But fair enough.
    – Octopus
    Commented Oct 12, 2013 at 6:12

What should happen? You should downvote it, comment with the reason the answer is incorrect, answer the question with the correct answer (or upvote an existing one) and move on. The OP is free to give the green check mark to whomever they wish. Acceptance is to indicate what helped the asker most, not what helped most people most, or is most correct.

Often, of course, the most correct answer is the one accepted. Scenarios where a wrong answer is accepted are the exception, not the rule.

Also, don't flag it. Moderators aren't here to remove incorrect content, the voting system generally takes care of that.


If I see such answers which are accepted and upvoted and incorrect, usually I comment (and downvote if I am 100% confident) on the answer and describe why the answer is incorrect. Possibly, the author of the answer may reply to you and clear your confusion/doubt. Or he update his answer with the correct one. If you disagree even after the answerer's response, you should downvote the post.

If the answer has a minor mistake like a typo, you can update the answer or ask the author to correct the typos.

Remember, flagging is not a correct option for incorrect answers. Moderators do not remove incorrect answers.

Not the answer you're looking for? Browse other questions tagged .