javascript - Why does jQuery does not accept my #ID from the array? -



javascript - Why does jQuery does not accept my #ID from the array? -

i'm trying add together 3 datepickers 3 of input fields echoeing next code:

this 1 works:

jquery(function(){ jquery("#newnessdate").datepicker({ dateformat: \'yy-mm-dd\', monthnames: [\'januar\',\'februar\',\'märz\',\'april\',\'mai\',\'juni\',\'juli\',\'august\',\'september\',\'oktober\',\'november\',\'dezember\'], daynames: [\'sonntag\', \'montag\', \'dienstag\', \'mittwoch\', \'donnerstag\', \'freitag\',\'samstag\'], daynamesmin: [\'so\', \'mo\', \'di\', \'mi\', \'do\', \'fr\', \'sa\'] }); }); jquery(function(){ jquery("#availabilitydate").datepicker({ dateformat: \'yy-mm-dd\', monthnames: [\'januar\',\'februar\',\'märz\',\'april\',\'mai\',\'juni\',\'juli\',\'august\',\'september\',\'oktober\',\'november\',\'dezember\'], daynames: [\'sonntag\', \'montag\', \'dienstag\', \'mittwoch\', \'donnerstag\', \'freitag\',\'samstag\'], daynamesmin: [\'so\', \'mo\', \'di\', \'mi\', \'do\', \'fr\', \'sa\'] }); }); jquery(function(){ jquery("#expirydate").datepicker({ dateformat: \'yy-mm-dd\', monthnames: [\'januar\',\'februar\',\'märz\',\'april\',\'mai\',\'juni\',\'juli\',\'august\',\'september\',\'oktober\',\'november\',\'dezember\'], daynames: [\'sonntag\', \'montag\', \'dienstag\', \'mittwoch\', \'donnerstag\', \'freitag\',\'samstag\'], daynamesmin: [\'so\', \'mo\', \'di\', \'mi\', \'do\', \'fr\', \'sa\'] }); });

this not:

var dateids = [ "#newnessdate", "#availabilitydate", "#expirydate" ]; (var = 0; < dateids.length; i++) { jquery(function(){ jquery(dateids[i]).datepicker({ dateformat: \'yy-mm-dd\', monthnames: [\'januar\',\'februar\',\'märz\',\'april\',\'mai\',\'juni\',\'juli\',\'august\',\'september\',\'oktober\',\'november\',\'dezember\'], daynames: [\'sonntag\', \'montag\', \'dienstag\', \'mittwoch\', \'donnerstag\', \'freitag\',\'samstag\'], daynamesmin: [\'so\', \'mo\', \'di\', \'mi\', \'do\', \'fr\', \'sa\'] }); }); }

i have tested lot , don't why not works in line

jquery(dateids[i]).datepicker({

it seems, jquery function not take strings array strings. can help me?

$("#newnessdate, #availabilitydate, #expirydate").datepicker({ dateformat: \'yy-mm-dd\', monthnames: [\'januar\',\'februar\',\'märz\',\'april\',\'mai\',\'juni\',\'juli\',\'august\',\'september\',\'oktober\',\'november\',\'dezember\'], daynames: [\'sonntag\', \'montag\', \'dienstag\', \'mittwoch\', \'donnerstag\', \'freitag\',\'samstag\'], daynamesmin: [\'so\', \'mo\', \'di\', \'mi\', \'do\', \'fr\', \'sa\'] }); }); }

javascript jquery arrays for-loop datepicker

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -