I am working on MVC4 project.My project have globalization.So i have to convert everything according to culture.
My culture will contain either pt-BR or en-US ... So i want to show jquery datepicker according to culture.
with reference from
How to set locale format from datepicker? and http://api.jqueryui.com/datepicker
i am able to show date picker in brazil but when i put condition its not working.Its not showing months as english. I have created jsfiddle also ,here is url http://jsfiddle.net/3unnf/
and code
//if i put value pt-BR ,its showing as brazilian culure but
//when i change its value ,it goes to else condition but do not show
// default culture ie. en-US
$(function() {
var currentCulture="pt-BR";
// $(".datefield2").datepicker($.datepicker.regional['pt-BR']);
if ($("#currentCulture").val() == "pt-BR") {
$(".datefield2").datepicker({
changeMonth: true,
changeYear: true
}).attr('readonly', 'readonly');
alert('qq1');
$(".datefield2").datepicker($.datepicker.regional["pt-BR"]);
}
else {
alert('qq');
$(".datefield2").datepicker({
changeMonth: true,
changeYear: true,
dateFormat: 'mm/dd/yy'
}).attr('readonly', 'readonly');
$(".datefield2").datepicker($.datepicker.regional[""]);
}
});
EDIT :
if i put $(".datefield2").datepicker($.datepicker.regional['']);
on top in else condition ..then changemonth dropdown not showing..you can check in jsfiddle too