If div doesn't have img tag, add a "no image" img to div (Javascript or Jquery) -
I am trying to include an IVG tag in a div element if the div element does not already have an IMG tag What is the best way to use? I want to see the answers in javascript and jquery so that it helps me learn but one is ok either.
I have used some jquery efforts. (Not) and .empty () But I think I am not thinking it correctly.
Try this:
if ($ ('$ your_div' ). ('Img'). Length == 0) {$ ('# your_div'). Prepaid ('& lt; img src = "img / your_image Jpg" / & gt;'); }
Comments
Post a Comment