How to change other textboxes value based on any text change?
Hi,
I am new to jquery, I am trying to update all textboxes value based on any textbox changed value and update this value to checked one, here are the code I am trying to get my task.
First I am trying to change div to textboxes, then I capturing changes textbox value and try to update when checkbox is checked, but I am receiving only on to checked box.
- <script type="text/javascript">
$(document).ready(function () {
var value1 = "";
$('div').each(function (index) {
$(this).replaceWith('<input type="text" id=div' + index + '><input type="checkbox" id=check' + index + '><br/>')
});
$('input').change(function () {
value1 = $(this).val();
alert(value1);
});
if ($('input[type="checkbox"]').is(':checked'))
alert(value1);
$(this).prev('input').val(value1);
});
</script>
Please check and suggest solution.