我需要一些帮助在jQuery生成的具有输入字段和选择选项的动态表格行。
我希望当我选择选项js时,输入字段id fee-2将被禁用,当我选择选项php输入字段id fee-1时,将被禁用,以此类推,在不同的行上插入更多的行,不同于select选项。最后,需要通过字段id fee-1插入所有行中的一些行
示例如图所示

我的小提琴演示在这里
http://fiddle.jshell.net/softfiddle/cSbbK/2/
谢谢
发布于 2013-09-30 05:04:20
将HTML更改为:
<td><input type="text" id="fee-1" class="fee" name="js-fee"></td>
<td><input type="text" id="fee-2" class="fee" name="php-fee"></td>然后使用这个Javascript:
$("#mytable").on("change", "select", function() {
var feeid = "#fee-" + $(this).val(); // Get ID of DIV related to selected item
$(".fee").prop('disabled', true); // Disable all the other DIVs
$(feeid).prop('disabled', false); // Enable the related DIV
// Now calculate the total
var total = 0;
$(".fee").each(function() {
total += parseInt($(this).text(), 10);
});
// And display it somewhere
$("#totaldiv").text(total);
});https://stackoverflow.com/questions/19083144
复制相似问题