
Untitled
By: a guest on
May 4th, 2012 | syntax:
None | size: 0.68 KB | hits: 13 | expires: Never
Accessing parent elements with jQuery input names
$('input[name=inputStartMonth]').change(function() {
var month = $(this).val();
$(this).parent().find('input[name=inputStart]').val(month);
});
<td><input name="inputStart" type="text" autocomplete="off" value="May '96">
<div class="startDateDrop hideThis dropForm">
<select name="inputStartMonth">
$('input[name="inputStartMonth"]')...
$(this).parent().prev('input[name="inputStart"]').val(month);
$(this).closest('form').find('input[name=inputStart]').val(month);
$('select[name=inputStartMonth]').change(function() {
var month = $(this).val();
$(this).closest('form').find('input[name=inputStart]').val(month);
});