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,576
  • 2
  • 36
  • 45
-2

you can use width method

$("#imageID").width() > 2
Vladu Ionut
  • 7,765
  • 1
  • 17
  • 30