I have developed a site for a client that uses a profile to capture address and contact information for event registrations using CiviEvent. One of the fields on the registration form is a 'Country' field. There is a requirement from the client to fill in another form field with a default value based upon the Country selected. I have done similar things with jQuery in relation to other fields on the form, but the country field widget is quite complicated and I can't quite figure out how to target the user's selecting a country and get the country value with jQuery. I am sure there must be some code in CiviCRM that does this, in order to display the correct set of state/province fields based upon the country selection. But I have not been able to locate such code. Can anyone give me any pointers in terms of where I can find the CiviCRM code that does this, or sample JS/jQuery code that will detect the country field selection on a profile form? Note that this is on CiviCRM 4.6.2.
Many thanks, -Ian