check if image does NOT exist then hide a div

前端 未结 4 945
猫巷女王i
猫巷女王i 2021-01-24 15:36

If there is an image in the div then hide the div. But if the image does exist then i need to keep the div visable.

But its not working. Here is my code:

4条回答
  •  后悔当初
    2021-01-24 16:05

    $("div#productInfoGrid").has('img').hide();
    

    Demo

    Note

    $("#div#productInfoGrid:not(img)") should be $("div#productInfoGrid:not(img)")

提交回复
热议问题