I am trying to insert a <br clear="all" /> after each fifth div. Below is how I create the divs in php and then I try to use jquery to seperate them. But it is not working! Any help would be greatly appreciated! Thanks in advance!
PHP:
$get = mysql_query("SELECT * FROM Products $cate ") or die(mysql_error());
while($row= mysql_fetch_array($get)){
$pname = $row['Pname'];
$image = $row['Pimage'];
$id = $row['ID'];
?>
<div class="productCat"><a href="product.php?id=<?php echo $id ?>"><img src="../products/<?php echo $image ?>" width="100" height="100" /><br /><?php echo $pname ?></a></div>
<?php
}
?>
JQUERY:
$(".productCat :nth-child(5)").append("<br clear='all'/>");
There isn’t supposed to be a space after
.productCat.Also, why not just do it in the PHP? Just add a counter: