Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 4th, 2012  |  syntax: None  |  size: 0.68 KB  |  hits: 13  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Accessing parent elements with jQuery input names
  2. $('input[name=inputStartMonth]').change(function() {
  3. var month = $(this).val();
  4. $(this).parent().find('input[name=inputStart]').val(month);
  5. });
  6.        
  7. <td><input name="inputStart" type="text" autocomplete="off" value="May '96">
  8. <div class="startDateDrop hideThis dropForm">
  9. <select name="inputStartMonth">
  10.        
  11. $('input[name="inputStartMonth"]')...
  12.        
  13. $(this).parent().prev('input[name="inputStart"]').val(month);
  14.        
  15. $(this).closest('form').find('input[name=inputStart]').val(month);
  16.        
  17. $('select[name=inputStartMonth]').change(function() {
  18.     var month = $(this).val();
  19.     $(this).closest('form').find('input[name=inputStart]').val(month);
  20. });