Consider that I have 10 input boxes, (using datepicker plugin Fyi)
I have a specific set of requirements for when the input box is clicked, or the plux/minus divs are hit too (to show/hide the 10 boxes as needed).
This loop doesn't seem to pick up the x and y variables.
the alert I have always echos 6 for example.. NO idea why..
here's my loop... and ideas why x and y don't seem to be set?
for (var x = 1; x <= 10; x++) {
var y = x+1;
$('#date_start'+y).attr("disabled", "disabled");
$('#date_start'+x).datetimepicker();
$('#date_start'+x).blur(function() {
if (isset($('#date_start'+x).val())) {
$('.add_time_'+x).css('visibility', 'visible');
} else {
$('.add_time_'+x).css('visibility', 'hidden');
$('.rem_time_'+y).css('visibility', 'hidden');
}
});
$('.add_time_'+x).click(function() {
alert('ici: ' + y);
$('.date_'+y).css('visibility', 'visible');
$('#date_start'+y).removeAttr("disabled");
$('.rem_time_'+y).css('visibility', 'visible');
});
$('.rem_time_'+y).click(function() {
$('.date_'+y).css('visibility', 'hidden');
$('#date_start'+y).attr("disabled", "disabled");
$('#date_start'+y).val('');
$('.rem_time_'+y).css('visibility', 'hidden');
$('.add_time_'+y).css('visibility', 'hidden');
});
}
=== Note, isset, is a seperate function I have to check if the field value is empty/not set When I try and echo out the value of $('#date_start'+x).val()
it echos undefined... even if the corresponding input HAS a value on screen.