And will you be doing that for every ticket type for every event? 😛 Because each event creates its own ticket_id (check the database wp_em_tickets), even if details seem alike. Since cut-off times (and dates) differ, EM makes a new ticket ID every time you create an event.
So you cannot really re-use the ticket ID in a future event. Targeting with “17” is not a great idea 😉
A question that came into my head:
Why would you want to pre-fill these fields?? And how would you know with what value? Are you trying to put in a placeholder, perhaps? Because the jQuery property is different then. A placeholder is more user-friendly than a value, as a placeholder automatically disappears when the field is selected. Also, placeholders are seen as “empty fields” when submitting the form. If you fill it as a default value, users can submit without changing the defaults. And you will get submissions without the actual required data. 😉
Back to the jQuery…
You will need to be looking into a solution more with .each() to loop through the inputs.
I took a new/closer look at the Attendee Form. Strangely enough the field ID is reused. Not the way it is supposed to be, but hey, you can benefit from that.;-)
Currently only ticket 17 (for the T-shirt) prefills with “dummy-voornaam”.
Okay, just thinking out loud now (so not tested):
Perhaps you could try something like this:
$('#attendee_voornaam').each( function() {
$(this).val('Mijn voornaam');
});
Hmmmm…. Perhaps you need to first target the spaces dropdown (.em-ticket-select), because the attendee fields are generated upon changing the selection. Look in your page source to see the fields are not on page load 😉
So then you would end up with a function triggering a function.
jQuery.noConflict();
jQuery(document).ready(function($) {
$(document.body).on('change', '.em-ticket-select', function() {
$('#attendee_voornaam').each( function() { $(this).attr("placeholder", "Mijn voornaam"); });
$('#attendee_achternaam').each( function() { $(this).attr("placeholder", "...en dit is mijn achternaam"); });
}).trigger('change');
});
Btw, you need to update the PayPal logo url (in EM Gateways) to use https://. It now gives a notice in the console. 😉