我正在教我的自我php和mysql.I创建一个小型商业网站来测试我的技能。 我网页上多发的形式这样jquery从相同的形式选择值
<div class="formInfo"><form name="CartForm" method="post" action="./ajax/addCart.php" class="fixed">
<input name="prodId" type="hidden" value="10" />
<label for="qty">Quantity:</label>
<input name="qty" type="text" id="qty" size="4" maxlength="6" class="qtyBox">
<br>
<input type="submit" name="addtoCart" id="addtoCart" value="Add to Cart" class="btnAdd">
</form>
<div class="formInfo"><form name="CartForm" method="post" action="./ajax/addCart.php" class="fixed">
<input name="prodId" type="hidden" value="7" />
<label for="qty">Quantity:</label>
<input name="qty" type="text" id="qty" size="4" maxlength="6" class="qtyBox">
<br>
<input type="submit" name="addtoCart" id="addtoCart" value="Add to Cart" class="btnAdd">
</form>
<div class="formInfo"><form name="CartForm" method="post" action="./ajax/addCart.php" class="fixed">
<input name="prodId" type="hidden" value="9" />
<label for="qty">Quantity:</label>
<input name="qty" type="text" id="qty" size="4" maxlength="6" class="qtyBox">
<br>
<input type="submit" name="addtoCart" id="addtoCart" value="Add to Cart" class="btnAdd">
</form>
现在,当我点击透过按钮,我想显示隐藏域ID和可见光领域QTA的值(目前点击形式) 到目前为止我的代码是
<script type="text/javascript">
$(document).ready(function(e) {
$('.formInfo').submit(function() {
alert($(this).val())
});
});
</script>
我不out.How告诉jQuery的,我想“ID”和“本”参考参考自身
正是我在寻找的感谢! – user1125033 2012-07-11 21:06:44