[英]My Javascript in webflow only works in first div. What am I doing wrong? (Radio buttons)
[英]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
我仍在学习PHP,我不知道出了什么问题。 jQuery仅在第一个图像上工作。 我从GitHub获得了jQuery(我不拥有它):
<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 * FROM `product_table` WHERE `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 to cart" name="addcart"/>
</form>
</div>';
}
echo'<p> </p>
<div id="description">
<p>'.html_entity_decode($data1['item_description']).'</p>
</div>
</div>
';
}
?>`
`
脚本替换此
$(document).ready(function(){
$('.ex1').zoom();
});
</script>
代替这个
$(document).ready(function(){
$('#ex1').zoom();
});
</script>
的HTML
取代这个
<span class="zoom ex1">
代替
<span class="zoom" id="ex1">
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.