0

How do I see if an image with 2px or more exist? Current code:

if( $("#imageID").length < 10) { 
   //Do something
   } 

2 Answers2

0

You can use naturalWidth and naturalHeight property of the image element.

   if( document.getElementById("imageID").naturalWidth > 2) { // TO DO: do something
   } 
asmmahmud
  • 4,844
  • 2
  • 40
  • 47
-2

you can use width method

$("#imageID").width() > 2
Vladu Ionut
  • 8,075
  • 1
  • 19
  • 30