Skip to content

Instantly share code, notes, and snippets.

@anil826
Last active June 25, 2019 05:53
Show Gist options
  • Save anil826/7973dde908eb8ad1e474c9712a9e7da6 to your computer and use it in GitHub Desktop.
Save anil826/7973dde908eb8ad1e474c9712a9e7da6 to your computer and use it in GitHub Desktop.
Select first option
//On change event for new repeat group data.
$('.new_repeat_entry_panel #component-6ee2-acfd-2e89 .input_content').change(function(){
//SetTimeout to wait for the options to load.
setTimeout(function(){
//Select first option from picklist you need to change the compoent-id
$('.new_repeat_entry_panel #component-49b8-df0d-2c75 .input_content > option:eq(1)').prop('selected', true);
},500)
})
//Existing repeat loop - please change the repeat group id.
for(var repeat_index = 0; repeat_index < formyoula.form_fields['abac-3e40-9273'].get('repeat_value').length; repeat_index++ ){
//Select the first option from select list.
//Please make sure the component-id and collapse_+ id (Repeat ID) based on your current form setup.
$('#collapse_abac-3e40-9273_'+repeat_index+' #component-2ced-b83a-7c60 .input_content > option:eq(1)').prop('selected', true);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment