My dynamic image tag <img>
is generated inside a div from the database using fetching
. Here is how my HTML looks:
<div class='forimgbox'>
<p class='palheading'>Pals</p>
<img src='userpic/2232323.png' width='80px' height='100px'>
<img src='userpic/44542.png' width='80px' height='100px'>
<img src='userpic/88282.png' width='80px' height='100px'>
<img src='userpic/67788.png' width='80px' height='100px'>
<img src='userpic/567886.png' width='80px' height='100px'>
<img src='userpic/456788.png' width='80px' height='100px'>
<img src='userpic/355667.png' width='80px' height='100px'>
</div>
I want to use jQuery to remove some <img>
tags from this parent div. Specifically, I want to keep the first '6' <img>
starting from the top and then delete any additional <img>
tags that were produced after the 6th tag from the database. Is this possible? My initial thought was to count the number of <img>
tags in the parent div
and then remove any tags after the 6th one. Your help is appreciated.