I have input field with id = datepicker
validationfails = true;
if(validationfails)
{
$('#datepicker').val('');
$('#datepicker').attr('placeholder','mm/dd/yyyy');
}
I want to show the placeholder, if validation fails.
But the placeholder does not appear. When i press the backspace in the input field, it appears.
how to fix this.?
Try: