-1
I have the script defined as follows:
<link rel="stylesheet" type="text/css" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.0/themes/base/jquery-ui.css"/ >
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.min.js"></script>
<script src="Scripts/jquery-ui-timepicker-addon.js" type="text/javascript"></script>
<script>
$(document).ready(function () {
var textbox = '<%=TextBoxDataInicial.ClientID%>';
var textbox = '<%=TextBoxDataFinal.ClientID%>';
$('#'+textbox).datepicker({
dateFormat: 'dd/mm/yy',
dayNames: ['Domingo', 'Segunda', 'Terça', 'Quarta', 'Quinta', 'Sexta', 'Sábado'],
dayNamesMin: ['D', 'S', 'T', 'Q', 'Q', 'S', 'S', 'D'],
dayNamesShort: ['Dom', 'Seg', 'Ter', 'Qua', 'Qui', 'Sex', 'Sáb', 'Dom'],
monthNames: ['Janeiro', 'Fevereiro', 'Março', 'Abril', 'Maio', 'Junho', 'Julho', 'Agosto', 'Setembro', 'Outubro', 'Novembro', 'Dezembro'],
monthNamesShort: ['Jan', 'Fev', 'Mar', 'Abr', 'Mai', 'Jun', 'Jul', 'Ago', 'Set', 'Out', 'Nov', 'Dez'],
nextText: 'Próximo',
prevText: 'Anterior'
})
});
</script>
and control as follows:
<td class="auto-style3">
<asp:TextBox ID="TextBoxDataInicial" runat="server" Width="120px" MaxLength="24" ReadOnly="True"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidatorDataInicio" runat="server" ControlToValidate="TextBoxDataInicial" ErrorMessage="Campo necessário!">*</asp:RequiredFieldValidator>
<asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ControlToValidate="TextBoxDataInicial" ErrorMessage="Data Inválida!(##/##/####)" Font-Bold="True" Font-Size="Smaller" ValidationExpression="(0?[1-9]|[12][0-9]|3[01])/(0?[1-9]|1[0-2])/((1[2-9]|[2-9][0-9])[0-9]{2})"></asp:RegularExpressionValidator>
</td>
<td class="auto-style3">
<asp:TextBox ID="TextBoxDataFinal" runat="server" Width="120px" MaxLength="25" ReadOnly="True"></asp:TextBox>
<asp:RegularExpressionValidator ID="RegularExpressionValidator2" runat="server" ControlToValidate="TextBoxDataFinal" ErrorMessage="Data Inválida!(##/##/####)" Font-Bold="True" Font-Size="Smaller" ValidationExpression="(0[1-9]|[12][0-9]|3[01])/(0[1-9]|1[0-2])/((1[2-9]|[2-9][0-9])[0-9]{2})"></asp:RegularExpressionValidator>
</td>
Is there an error in the console? can you explain "not working" better? Shouldn’t be using the textbox with
ID="datepicker"
here$('#' + textbox).datepicker({
?– Sergio
No error. Only when I click on the textbox does not show the calendar.
– user6018
Why
$('#' + textbox)
and not$('#datepicker')
? How many datepickers will you have?– Sergio
in at least two Textbox
– user6018
@user6018 Anyway, confirm if the value of
textbox
is correct (I understand that it must return the ID of its element, but it returns with or without the#
?), printing it on the console. Because if there is no error, it is likely that the selector is wrong...– mgibsonbr
can place the html of the two textboxes?
– Sergio
I’ll edit the question
– user6018