Support

Home Forums Event Espresso Premium date of birth field ID for Jquery datepicker

date of birth field ID for Jquery datepicker

Posted: October 20, 2015 at 5:35 am


Lane Houk

October 20, 2015 at 5:35 am

Hello Support,

i applied jquery datepicker on DOB field https://sohopefl.org/events/ on the checkout page of user registration but the field ID is changing everytime. please let me know how to get permanent id for the DOB field.

Thanks


Lorenzo Orlando Caum

  • Support Staff

October 20, 2015 at 9:43 am

Hi,

Have you considered targeting the question label?

https://eventespresso.com/topic/event-registration-questions-customisation/#post-52793


Lorenzo


Lane Houk

October 23, 2015 at 6:25 am

Hello Lorenzo,

can you please explain more my question label looks like “Birth Date (DD/MM/YYYY)” what should i target.

Thanks


Lorenzo Orlando Caum

  • Support Staff

October 23, 2015 at 7:05 am

Hi, instead of setting your sample code to look for the field ID, try using something static that won’t change like the question name (label):

jQuery('label:contains("Birth Date"), label:contains("Birth Date (DD/MM/YYYY)")').next('input').datepicker({dateFormat: "dd/mm/yyyy"});

Does that help?


Lorenzo


Lane Houk

October 23, 2015 at 7:18 am

i am using like this to call datepicker:

jQuery(document).ready(function() {
jQuery('#TEXT_14-4-131-2').datepicker({
dateFormat: "dd/mm/yy",
defaultDate: "01/01/1970",
minDate: "01/01/1925",
maxDate: "12/31/2015",
changeMonth: true,
changeYear: true,
yearRange: "1925:2015"
});
});

how to change ID here with given Label.


Lorenzo Orlando Caum

  • Support Staff

October 23, 2015 at 7:45 am

Switching out the ID to use a label should work:

jQuery(document).ready(function() {
jQuery('label:contains("Birth Date"), label:contains("Birth Date (DD/MM/YYYY)")').next('input').datepicker({
dateFormat: "dd/mm/yy",
defaultDate: "01/01/1970",
minDate: "01/01/1925",
maxDate: "12/31/2015",
changeMonth: true,
changeYear: true,
yearRange: "1925:2015"
});
});


Lorenzo


Lane Houk

October 23, 2015 at 8:05 am

its working. Thanks Man for great help.

The support post ‘date of birth field ID for Jquery datepicker’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Event Espresso