javascript - textbox access for datepicker -


i'm using date picker jquery plugin created stefan petre , available here:

http://www.eyecon.ro/datepicker/#about

this code i'm using apply datepicker textboxes

 $('.tablemstcellecd').datepicker({             format: 'd/m/y',             date: $('.tablemstcellecd').val(),             current: $('.tablemstcellecd').val(),             calendars: 3,             onchange: function (formated, dates) {                 $('.tablemstcellecd').val(formated);                 $('.tablemstcellecd').datepickerhide();             }         }); 

it works fine, updates values of textboxes instead of selected one. problem there can different number of texboxes cannot hard code access values. trying implement "this" keyword somewhere command did not succeed

i agree deepanshu, should use jquery ui. if want avoid reason, karelg's solution works fine, since include jquery, can write that:

$('.tablemstcellecd').each(function(){     var id = $(this).attr('id');     $(this).datepicker({         format: 'd/m/y',         date: $('#' + id).val(),         current: $('#' + id).val(),         calendars: 1,         onchange: function (formated, dates) {             $('#' + id).val(formated);             $('#' + id).datepickerhide();         }     }); }); 

you have generate unique id-s input elements either on server or client side, this:

<input type="text" id="01" class="tablemstcellecd" /> <input type="text" id="02" class="tablemstcellecd" /> <input type="text" id="03" class="tablemstcellecd" /> <input type="text" id="04" class="tablemstcellecd" /> 

Comments

Popular posts from this blog

javascript - DIV "hiding" when changing dropdown value -

Does Firefox offer AppleScript support to get URL of windows? -

android - How to install packaged app on Firefox for mobile? -