on change same value of input type text but different id in jquery -
i create table looping rows has 3 column input type text 3 input fields, give 2 & 3 input field same value input field 1 check out if code correct?
demo: https://jsfiddle.net/ninay/cpk15a98/
$('#thelist[' + counter +'].docdt').change(function() { for(i=1; i<counter; i++){ $('#thelist[' + + '].startdt ,#thelist[' + + '].enddt').val($(this).val()); }});
why use dot . when setting element id?
id="thelist[' + counter +'].startdt"
#thelist[' + counter + '].docdt selector mean target html element have:
- id
thelist[' + counter + '] - class
docdt
you must use character replace dot . ex: _
i suggest use class selector problem, class selector can setting change event without `.each' loop.
i had change demo pls check that! hope can you! https://jsfiddle.net/cpk15a98/6/
Comments
Post a Comment