我是 jQuery 的新手。我已经编写了一个代码来将产品从一个表添加到另一个表中,就像这样动态检查FIDDLE:正如您在小提琴中看到的那样,此代码对我来说工作正常。
现在我通过使用 ajax 动态生成此产品列表(表 2)来操作此代码,现在此代码对我不起作用..
当我想到这个缺陷时,我认为我的所有 CSS 和 JS 脚本都随着页面的加载而加载,但是这个复选框(表 2)动态加载,这就是为什么 JS 没有娱乐这个......
那么如何在动态加载的输入字段上触发事件函数......只希望这个脚本得到改进: JQUERY 1.6.4
这是我的观点:
<div class="_25">
<?php echo form_dropdown('class', $dropdown_class,'','id="clas"'); ?>
</div>
<div class="_25">
<?php echo form_dropdown('section',$dropdown_section); ?>
</div>
<table class="table" border="1">
<thead><tr>
<th>Select</th>
<th>Cause</th>
<th>Monthly Charge</th>
</tr></thead>
<tbody id="selectedServices"></tbody>
<tr>
<td>Total-</td>
<td>Fee</td>
<td id="total">1500</td>
</tr>
</table>
<!-- product list (will generate dynmiclly)like tble 2 in fiddle -->
<table id="abcd" class="table" border="1">
<thead><tr>
<th>Select</th>
<th>Cause</th>
<th>Monthly Charge</th>
</tr></thead>
<tbody …Run Code Online (Sandbox Code Playgroud) 我试图使用jQuery-ajax发布表单,并且我在点击时发布表单时收到此错误.
TypeError: Value does not implement interface HTMLInputElement
这是我的JavaScript代码:
$('document').ready(function () {
$('#update').click(function () {
jQuery.post("update_category", {
c_id: c_id,
c_name: c_name,
c_description: c_description
},
function (data, textStatus) {
if (data == 1) {
$('#response').html("Thank You!!..We Will Get Back To You Soon..!!");
$('#response').css('color', 'green');
} else {
$('#response').html("Some Error Occurred");
$('#response').css('color', 'red');
}
});
});
});
Run Code Online (Sandbox Code Playgroud)
我的表格:
<div id="form">
<form>
<!-- PRONT DROP DOWN HERE !-->
<input type="text" name="c_id" id="c_id" disabled="disble" placeholder="'.strtoupper($r['c_id']).'" value="'.strtoupper($r['c_id']).'" ></input>
<input type="text" name="c_name" id="c_name" disabled="disble" placeholder="'.strtoupper($r['c_name']).'" value="'.strtoupper($r['c_name']).'"></input> …Run Code Online (Sandbox Code Playgroud)