I have an input [date_caisse] with a class: datepicker-inline And id: [date_caisse]
I have this function initialized on all my web pages:
function InitEvents () { $('.datepicker-inline').datepicker({ showButtonPanel: true, /*added by oussama*/ changeMonth: true, /*added by oussama*/ changeYear: true, /*added by oussama*/ firstDay: 1, dateFormat: 'yy-mm-dd',/*'dd/mm/yy'*/ onSelect: function (dateText, inst) { //alert('select!'); id = $(this).attr('id'); parts = id.split('-'); id2 = parts[parts.length -1]; $('#datepicker-target-id-' + id2).val(dateText); } });
}
I want to apply onSelect only on the current page, so this is what I did:
$('#date_caisse').datepicker({ onSelect: function (dateText, inst) { alert('select!'); } });
When I put a warning ('select!'); in the main js file (which is called on all pages) it works! but this does not happen when I try to trigger an action through the current file.
Perhaps onSelect should not be called twice.
So can anyone help me?
Thanks and had a good day!
source share