DEV Community

Rustamjon Akhmedov
Rustamjon Akhmedov

Posted on

Answer: Elementor Extension: How can i set a repeater item title to the current value of a select

To tackle this problem, I crafted a JavaScript function:

function flanceTitleHelper(country) {
  const countryValues = {
    '1': 'Afghanistan',
    '2': 'Albania',`enter code here`
    // Add more countries as needed
  };
  return countryValues[country] || 'default';
}

For the title field, I defined it like this:

'title_field' => '{{{ flanceTitleHelper(country) }}}',

Top comments (0)