【发布时间】:2013-09-03 02:58:03
【问题描述】:
任何人都可以帮助更改此代码以发布功能吗? 例子:
代码:
<div id="address-wrap">
<div id="report-address">3719 COCOPLUM CIR <br>Unit: 3548<br>COCONUT CREEK, FL 33063</div>
<div id="report-button">
<form action="report.html">
<input name="property-id[]" type="text" class="property-id" value="64638716">
<input name="submit" type="submit" value="View Report" class="view_report">
</form>
</div>
<div id="clear"></div>
</div>
<div id="address-wrap">
<div id="report-address">3927 COCOPLUM CIR <br>Unit: 35124<br>COCONUT CREEK, FL 33063</div>
<div id="report-button">
<form action="report.html">
<input name="property-id[]" type="text" class="property-id" value="64638744">
<input name="submit" type="submit" value="View Report" class="view_report">
</form>
</div>
<div id="clear"></div>
</div>
<div id="address-wrap">
<div id="report-address">3949A COCOPLUM CIR <br>Unit: A<br>COCONUT CREEK, FL 33063</div>
<div id="report-button">
<form action="report.html">
<input name="property-id[]" type="text" class="property-id" value="64639105">
<input name="submit" type="submit" value="View Report" class="view_report">
</form>
</div>
<div id="clear"></div>
</div>
<div id="address-wrap">
<div id="report-address">3949 COCOPLUM CIR <br>Unit: 3602<br>POMPANO BEACH, FL 33063</div>
<div id="report-button">
<form action="report.html">
<input name="property-id[]" type="text" class="property-id" value="64639106">
<input name="submit" type="submit" value="View Report" class="view_report">
</form>
</div>
<div id="clear"></div>
</div>
<div id="address-wrap">
<div id="report-address">3949 COCOPLUM CIR <br>Unit: 3603<br>COCONUT CREEK, FL 33063</div>
<div id="report-button">
<form action="report.html">
<input name="property-id[]" type="text" class="property-id" value="64639107">
<input name="submit" type="submit" value="View Report" class="view_report">
</form>
那个帖子到:
$(document).ready(function(e) {
$("input[type=submit]").click(function(e) {
var propertyid = $(this).prevAll("input").first().val();
alert(propertyid);
});
});
例子:
我们怎样才能改变这种正确的方式来发布到函数??
【问题讨论】:
-
“发布到功能”是什么意思?
-
像这样发布:onclick="quantity('product1');"和脚本功能是这样的: function quantity(item_id) { var propertyid = $(this).prevAll("input").first().val();警报(propertyid); ,,,, 但这不起作用,所以需要以正确的方式执行此操作
-
您发布的小提琴似乎正在工作。它显示正确的警报。究竟是什么问题?
-
我想把它发布到一个函数而不是 $(document).ready(function(e) { 我希望它像这样发布:像这样发布它:onclick="quantity('product1' );" 和脚本函数就像:function quantity(item_id) { var propertyid = $(this).prevAll("input").first().val(); alert(propertyid); } ,,,, 但是这个不工作,所以需要以正确的方式做到这一点