Js determines whether there is an img in a class.

<div class="imgpd">
123
456
789
...
<div>

check whether there is a tag in imgpd. If not, add a * >

.
Aug.27,2021

first add id

<div class="imgpd" id="imgpd">
123
456
789
...
<div>

then get the length of img

document.getElementById('imgpd').getElementByTagName('img').length

if the length is greater than 0, it means there is a picture, otherwise there is no picture


$('.imgpd').append(function(){
    if (!$(this).children().is('img')) {
        return '<img>';
    }
});
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b36420-343c7.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b36420-343c7.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?