javascript - The jQuery works only works on the first div when looping divs. I am still learning PHP and I can't figure out what's wrong -
i still learning php , can't figure out what's wrong. jquery working on first image only. got jquery github (i not own it):
<script src='http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js'> </script> <script src='jquery/jquery.zoom.js'></script> <script> $(document).ready(function(){ $('#ex1').zoom(); }); </script> <?php $budgetselect = 'select * `product_table` `item_category`="gaming"'; $budgetquery = mysql_query($budgetselect); while ($data1 = mysql_fetch_array($budgetquery)) { echo' <form method="post" action="process/addtocart.php"> <div id="product"> <div id="prod_image"> <span class="zoom" id="ex1"> <img src="'.$data1['item_image'].'"width="65%" height="65%"/> </span> </div> <p><h2>'.html_entity_decode($data1['item_name']).'</h2></p> <div id="prodprice"><h2>php: '.$data1['item_price'].'</h2></div> <input type="hidden" name="item_name" value="'.$data1['item_name'].'"/> <input type="hidden" name="item_price" value="'.$data1['item_price'].'"/> <input type="hidden" name="item_image" value="'.$data1['item_image'].'"/> <input type="hidden" name="item_quantity" value="1"/> '; if(isset($_session['uid'])){ echo' <div id="addtocart"> <input type="image" src="img/mono-icons/addcart.png" width="32" height="32" alt="add cart" name="addcart"/> </form> </div>'; } echo'<p> </p> <div id="description"> <p>'.html_entity_decode($data1['item_description']).'</p> </div> </div> '; } ?>`
`
script replace
$(document).ready(function(){ $('.ex1').zoom(); }); </script>
in place of
$(document).ready(function(){ $('#ex1').zoom(); }); </script>
html
replace this
<span class="zoom ex1">
in place of
<span class="zoom" id="ex1">
Comments
Post a Comment