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

Popular posts from this blog

c# - Update a combobox from a presenter (MVP) -

How to understand 2 main() functions after using uftrace to profile the C++ program? -

How to put a lock and transaction on table using spring 4 or above using jdbcTemplate and annotations like @Transactional? -