<script src="jquery-1.10.2.min.js" type="text/javascript" /></script>
<script>
$(document).ready(function(){
$(".addCF").click(function(){
$("#customFields").append('<tr valign="top"><td><select class="select" name="select[]"><option value="">-select-</option><option value="a">a</option><option value="b">b</option><option value="c">c</option></select> <input type="text" class="selval" name="selval[]" readonly /> <a href="javascript:void(0);" class="remCF">Remove</a></td></tr>');
});
$("#customFields").on('click','.remCF',function(){
$(this).parent().parent().remove();
});
});
$(document).on('change','.select',function() {
var selval = $(this).val();
$(this).parent('td').find('.selval').val(selval);
//alert(selval);
});
</script>
<table class="form-table" id="customFields">
<tr valign="top">
<td>
<select class="select" name="select[]">
<option value="">-select-</option><option value="a">a</option><option value="b">b</option><option value="c">c</option></select> <input type="text" class="selval" name="selval[]" readonly />
<a href="javascript:void(0);" class="addCF">Add</a>
</td>
</tr>
</table>
<script>
$(document).ready(function(){
$(".addCF").click(function(){
$("#customFields").append('<tr valign="top"><td><select class="select" name="select[]"><option value="">-select-</option><option value="a">a</option><option value="b">b</option><option value="c">c</option></select> <input type="text" class="selval" name="selval[]" readonly /> <a href="javascript:void(0);" class="remCF">Remove</a></td></tr>');
});
$("#customFields").on('click','.remCF',function(){
$(this).parent().parent().remove();
});
});
$(document).on('change','.select',function() {
var selval = $(this).val();
$(this).parent('td').find('.selval').val(selval);
//alert(selval);
});
</script>
<table class="form-table" id="customFields">
<tr valign="top">
<td>
<select class="select" name="select[]">
<option value="">-select-</option><option value="a">a</option><option value="b">b</option><option value="c">c</option></select> <input type="text" class="selval" name="selval[]" readonly />
<a href="javascript:void(0);" class="addCF">Add</a>
</td>
</tr>
</table>
No comments:
Post a Comment