---
title: Address Template
product: Survey Creator
description: Explore our free Address Component demo for JavaScript that shows how to integrate of a pre-designed address template with multiple input fields into your non-cloud SurveyJS form builder. Help users save time and simplify form creation.
framework: jQuery
source: https://surveyjs.io/survey-creator/examples/add-address-to-form-template/jquery
index: https://surveyjs.io/survey-creator/examples/overview.md
---

# Address Template (jQuery)

The Address template is a reusable question that survey authors can add to their forms to ask respondents for an address. To implement this question in your application, you need to create a composite question type.

[Create Composite Question Types](https://surveyjs.io/form-library/documentation/customize-question-types/create-composite-question-types (linkStyle))

## Files

### `public/index.html`

```html
<!-- Uncomment the following lines to enable Ace Editor in the JSON Editor tab -->
<!-- 
<script src="https://unpkg.com/ace-builds/src-min-noconflict/ace.js"></script>
<script src="https://unpkg.com/ace-builds/src-min-noconflict/ext-searchbox.js"></script>
<script src="https://unpkg.com/ace-builds/src-min-noconflict/theme-clouds_midnight.js"></script>
-->

<div id="surveyCreatorContainer" style="position: absolute; height: 100%; width: 100%"></div>
```

### `src/index.css`

```css
/* You can add your custom CSS here. */
```

### `src/index.js`

```js
import { SurveyCreator } from "survey-creator-js";
import "survey-core/survey.i18n";
import "survey-creator-core/survey-creator-core.i18n";
import { ComponentCollection, Serializer } from "survey-core";
import "survey-core/survey-core.css";
import "survey-creator-core/survey-creator-core.css";
import "./index.css";

import SurveyTheme from "survey-core/themes";
import { registerCreatorTheme } from "survey-creator-core";

registerCreatorTheme(SurveyTheme); // Add predefined Survey Creator UI themes

ComponentCollection.Instance.add({
    name: "address",
    title: "Address",
    defaultQuestionTitle: "Enter your address:",
    elementsJSON: [{
        "type": "text",
        "name": "addressLine1",
        "title": "Address",
        "placeholder": "495 Grove Street"
    }, {
        "type": "text",
        "name": "addressLine2",
        "title": "Address line 2",
        "placeholder": "Apartment #20"
    }, {
        "type": "text",
        "name": "city",
        "title": "City/Town",
        "placeholder": "New York"
    }, {
        "type": "text",
        "name": "state",
        "startWithNewLine": false,
        "title": "State/Region/Province",
        "placeholder": "NY"
    }, {
        "type": "text",
        "name": "postCode",
        "title": "Zip/Postal code",
        "inputType": "number",
        "min": 501,
        "max": 14925,
        "placeholder": "10014",
        "startWithNewLine": false
    }, {
        "type": "dropdown",
        "name": "country",
        "title": "Country",
        "placeholder": "USA",
        "choicesByUrl": {
            "url": "https://surveyjs.io/api/CountriesExample",
        }
    }]
});
const creator = new SurveyCreator();
creator.toolbox.defineCategories([{
    category: "Custom Items",
    items: [
        "address"
    ]
}], true);

creator.JSON = {
  elements: [{
    type: "address",
    name: "question1"
  }]
};
creator.render("surveyCreatorContainer");
```

### `package.json`

```json
{
  "dependencies": {
    "jquery": "latest",
    "survey-core": "latest",
    "survey-js-ui": "latest",
    "survey-creator-core": "latest",
    "survey-creator-js": "latest"
  },
  "devDependencies": {
    "react-scripts": "latest"
  }
}
```

## Other Frameworks

- [Angular](https://surveyjs.io/survey-creator/examples/add-address-to-form-template/angular.md)
- [React](https://surveyjs.io/survey-creator/examples/add-address-to-form-template/reactjs.md)
- [Vue 3](https://surveyjs.io/survey-creator/examples/add-address-to-form-template/vue3js.md)
- [Vanilla JS](https://surveyjs.io/survey-creator/examples/add-address-to-form-template/vanillajs.md)
