How to change wording such as “County” to “State” in an Address No Postcode question.
At a glance: This method changes matching placeholders across the scheme and re-applies the wording after triggered questions are redrawn.
Overview
SchemeServe provides address question types for journeys with and without a postcode. For an overseas journey, use Address No Postcode and, where needed, use a trigger to show the correct address question based on the customer’s location.
- Address: full address entry including postcode.
- Address No Postcode: address entry excluding postcode.
Scheme terminology settings can change general wording such as county, postcode, province, or ZIP code. Use Custom JS when the required placeholder cannot be achieved through those settings.
Important: Custom JavaScript can affect the entire quote journey. Do not replace working site code without reviewing it first. If you are not confident with JavaScript, request help from Obsessive Support.
Before You Begin
- Confirm whether the wording should change throughout the scheme or only for one question.
- Take a copy of the existing Custom JS before editing it.
- Identify the visible question text used by the Address No Postcode question.
- Make the change in a test scheme or test journey before using it in production.
Configure the Address Questions
- Add the UK address question. Use the Address question type when the address includes a UK postcode.
- Add the overseas address question. Use Address No Postcode when a postcode should not be required.
- Add a location question. Use a country question or a Yes/No question such as “Is this address in the UK?”
- Create the triggers. Show the Address question for UK answers and the Address No Postcode question for non-UK answers.
- Test both paths. Confirm that only the relevant address question is displayed for each answer.
Trigger example: If “Is this address in the UK?” equals Yes, show Address. If it equals No, show Address No Postcode.
Add the Custom JavaScript
- Open the scheme’s site settings. Go to Settings, then Site Settings.
- Open Custom JS. Review the existing script before making a change.
- Add the placeholder code. Use the example below and adjust the question text and replacement wording where required.
- Save and test. Refresh the quote journey, then test the question before and after its trigger fires.
Example: Change “County” to “State”
The example below targets Address No Postcode inputs and changes any placeholder containing “County” to “State”. The fallback search uses the visible question text “No Postcode Test”. Replace that value with the exact text shown on your question.
document.addEventListener("DOMContentLoaded", () => {
const questionText = "No Postcode Test";
function renameCountyToState() {
const renamePlaceholder = (input) => {
if (
input.placeholder &&
input.placeholder.toLowerCase().includes("county")
) {
input.placeholder = input.placeholder.replace(
/county/gi,
"State"
);
}
};
// Match SchemeServe Address No Postcode inputs.
document.querySelectorAll(
"input[name*='NoPostcode'], input[id*='NoPostcode']"
).forEach(renamePlaceholder);
// Fallback: find the question by its visible text.
document.querySelectorAll(
"label, legend, h1, h2, h3, h4, h5, div, span"
).forEach((element) => {
if (element.textContent.trim() !== questionText) {
return;
}
let container = element.parentElement;
for (let i = 0; i < 6 && container; i += 1) {
const countyInput = Array.from(
container.querySelectorAll("input")
).find((input) =>
input.placeholder &&
input.placeholder.toLowerCase().includes("county")
);
if (countyInput) {
renamePlaceholder(countyInput);
return;
}
container = container.parentElement;
}
});
}
// Apply the change on initial page load.
renameCountyToState();
// Re-apply it when triggered questions are redrawn.
const addressObserver = new MutationObserver(
renameCountyToState
);
addressObserver.observe(document.body, {
childList: true,
subtree: true
});
});Existing Custom JS: If the site already uses a DOMContentLoaded wrapper or SchemeServe custom boilerplate, merge this logic into the existing structure rather than pasting a second copy of the whole site script. Ask Obsessive Support to review the merge if you are unsure.
Adapt the Example
- Change the replacement text: replace "State" with the wording required by the journey.
- Change the source placeholder: replace /county/gi and the includes("county") checks if a different word must be changed.
- Change the fallback question text: replace "No Postcode Test" with the exact visible question wording.
Test the Change
- Open a new quotation and confirm that the original placeholder has changed.
- Answer the trigger both ways and confirm that the correct address question appears.
- Move backwards and forwards through the journey to confirm the wording remains correct after redraws.
- Test on both desktop and mobile layouts used by the scheme.
- Check other Address No Postcode questions because the primary selector is scheme-wide.
Troubleshooting
| Issue | What to check |
|---|---|
| The placeholder does not change | Confirm that the input placeholder contains “County” and that the question uses Address No Postcode. Check the browser console for JavaScript errors. |
| The triggered question uses the old wording | Confirm that the MutationObserver section is present and that it observes document.body with childList and subtree enabled. |
| The wrong question is shown | Review the trigger answer and confirm that UK and non-UK outcomes point to the correct address question types. |
| Several questions change | This is expected when multiple matching Address No Postcode inputs exist. Request support if the change must be limited to one question. |
Need Help?
If you are not comfortable with JavaScript, contact Obsessive Support.

