---
title: Pop-Up Survey
product: Form Library
description: Learn how to create a popup survey in JavaScript to collect insights in a JavaScript application. View free demo example to learn more.
framework: jQuery
source: https://surveyjs.io/form-library/examples/popup-survey/jquery
index: https://surveyjs.io/form-library/examples/overview.md
---

# Pop-Up Survey (jQuery)

SurveyJS Form Library allows you to embed pop-up surveys in your website. You can use this functionality to create exit-intent popups, pop-up quizzes, lead generation popups, and other kinds of website pop-up surveys. For example, this demo shows how to display a customer feedback survey in an embedded pop-up window.

When you design a pop-up survey for a website, you can use the same JSON schema you would use for a survey displayed inside a page. However, to render a website pop-up survey, use the [`PopupSurvey`](https://surveyjs.io/Documentation/Library?id=popupsurveymodel) object instead of `Survey`. To expand or collapse a pop-up survey, use the [`isExpanded`](https://surveyjs.io/form-library/documentation/api-reference/pop-up-survey-model#isExpanded) property or the [`expand()`](https://surveyjs.io/form-library/documentation/api-reference/pop-up-survey-model#expand) and [`collapse()`](https://surveyjs.io/form-library/documentation/api-reference/pop-up-survey-model#collapse) methods. If you need to handle popup closure, subscribe to the `onClose` event.

## Files

### `public/index.html`

```html
<div id="surveyElement" style="position: absolute; top: 0; left: 0; right: 0; bottom: 0; min-height: 100%; height:100%"></div>
```

### `src/index.css`

```css
.sv_window {
    bottom: 15% !important;
}
```

### `src/index.js`

```js
import $ from "jquery";
import { Model } from "survey-core";
import "survey-js-ui";
import "survey-core/survey-core.min.css";
import "./index.css";
import { json } from "./json";
import { themeJson } from "./theme";

const survey = new Model(json);
// You can delete the line below if you do not use a customized theme
survey.applyTheme(themeJson);
const handlePopupClose = () => {
    // ...
    // Perform actions when users close the popup
    // ...
}
$("#surveyElement").PopupSurvey({
    model: survey,
    isExpanded: true,
    closeOnCompleteTimeout: -1,
    allowClose: true,
    onClose: handlePopupClose
});
```

### `src/json.js`

```js
export const json = {
  "title": "Send Feedback to the Team",
  "description": "Need help? Visit our support page",
  "completedHtml": "<h3>Thank you for your feedback</h3>",
  "pages": [
    {
      "name": "page1",
      "elements": [
        {
          "type": "comment",
          "name": "feedback",
          "title": "Describe your feedback"
        }
      ]
    }
  ],
  "completeText": "Send",
  "widthMode": "responsive"
};
```

### `src/theme.js`

```js
export const themeJson = {
  "backgroundImage": "",
  "backgroundImageFit": "cover",
  "backgroundImageAttachment": "scroll",
  "backgroundOpacity": 1,
  "header": {
    "height": 80,
    "inheritWidthFrom": "container",
    "textAreaWidth": 512,
    "overlapEnabled": false,
    "backgroundImageOpacity": 1,
    "backgroundImageFit": "cover",
    "logoPositionX": "right",
    "logoPositionY": "top",
    "titlePositionX": "left",
    "titlePositionY": "bottom",
    "descriptionPositionX": "left",
    "descriptionPositionY": "bottom"
  },
  "themeName": "custom",
  "isPanelless": true,
  "colorPalette": "light",
  "cssVariables": {
    "--sjs2-color-bg-basic-primary": "rgba(255, 255, 255, 1)",
    "--sjs2-color-utility-property-grid": "rgba(255, 255, 255, 1)",
    "--sjs2-color-utility-tabs": "rgba(255, 255, 255, 1)",
    "--sjs2-color-utility-toolbox": "rgba(255, 255, 255, 1)",
    "--sjs2-color-bg-basic-primary-dim": "rgba(248, 248, 248, 1)",
    "--sjs2-color-bg-neutral-tertiary-dim": "rgba(255, 255, 255, 1)",
    "--sjs2-color-utility-surface-survey-panelless": "rgba(255, 255, 255, 1)",
    "--sjs2-color-utility-surface-survey": "rgba(255, 255, 255, 1)",
    "--sjs2-color-bg-basic-secondary": "rgba(249, 249, 249, 1)",
    "--sjs2-color-bg-basic-secondary-dim": "rgba(243, 243, 243, 1)",
    "--sjs2-color-fg-basic-primary": "rgba(0, 0, 0, 0.91)",
    "--sjs2-color-fg-basic-secondary": "rgba(0, 0, 0, 0.45)",
    "--sjs2-color-project-brand-600": "rgba(25, 179, 148, 1)",
    "--sjs2-color-bg-brand-secondary": "rgba(25, 179, 148, 0.1)",
    "--sjs2-color-bg-brand-primary-dim": "rgba(20, 164, 139, 1)",
    "--sjs2-color-fg-brand-on-primary": "rgba(255, 255, 255, 1)",
    "--sjs2-color-fg-brand-primary-disabled": "rgba(255, 255, 255, 0.25)",
    "--sjs2-base-unit-size": "6px",
    "--sjs2-base-unit-spacing": "6px",
    "--sjs2-base-unit-radius": "4px",
    "--sjs2-color-bg-accent-primary": "rgba(255, 152, 20, 1)",
    "--sjs2-color-bg-accent-secondary": "rgba(255, 152, 20, 0.1)",
    "--sjs2-color-bg-accent-secondary-dim": "rgba(255, 152, 20, 0.25)",
    "--sjs2-color-fg-accent-on-primary": "rgba(255, 255, 255, 1)",
    "--sjs2-color-fg-accent-primary-disabled": "rgba(255, 255, 255, 0.25)",
    "--sjs2-border-effect-surface-default": "0px 1px 2px 0px rgba(0, 0, 0, 0.15)",
    "--sjs2-border-effect-floating-default": "0px 2px 6px 0px rgba(0, 0, 0, 0.1),0px 8px 16px 0px rgba(0, 0, 0, 0.1)",
    "--sjs2-border-effect-component-formbox-default": "inset 0px 1px 2px 0px rgba(0, 0, 0, 0.15)",
    "--sjs2-border-effect-component-check-true-default": "inset 0px 1px 2px 0px rgba(0, 0, 0, 0.15)",
    "--sjs2-border-effect-component-check-false-default": "inset 0px 1px 2px 0px rgba(0, 0, 0, 0.15)",
    "--sjs2-color-border-basic-secondary": "rgba(0, 0, 0, 0.09)",
    "--sjs2-color-component-input-default-line": "rgba(0, 0, 0, 0.16)",
    "--sjs2-color-border-basic-secondary-overlay": "rgba(0, 0, 0, 0.16)",
    "--sjs2-color-bg-alert-primary": "rgba(229, 10, 62, 1)",
    "--sjs2-color-bg-alert-secondary": "rgba(229, 10, 62, 0.1)",
    "--sjs2-color-fg-alert-on-primary": "rgba(255, 255, 255, 1)",
    "--sjs2-color-bg-positive-primary": "rgba(25, 179, 148, 1)",
    "--sjs2-color-bg-positive-secondary": "rgba(25, 179, 148, 0.1)",
    "--sjs2-color-fg-positive-on-primary": "rgba(255, 255, 255, 1)",
    "--sjs2-color-bg-note-primary": "rgba(67, 127, 217, 1)",
    "--sjs2-color-bg-note-secondary": "rgba(67, 127, 217, 0.1)",
    "--sjs2-color-fg-note-on-primary": "rgba(255, 255, 255, 1)",
    "--sjs2-color-bg-warning-primary": "rgba(255, 152, 20, 1)",
    "--sjs2-color-bg-warning-secondary": "rgba(255, 152, 20, 0.1)",
    "--sjs2-color-fg-warning-on-primary": "rgba(255, 255, 255, 1)",
    "--sjs2-typography-font-size-component-header-title": "24px",
    "--sjs2-color-component-header-default-title": "rgba(25, 179, 148, 1)",
    "--sjs2-typography-font-weight-component-header-description": "400",
    "--sjs2-color-component-header-default-description": "rgba(0, 0, 0, 0.45)",
    "--sjs2-color-component-header-default-bg": "transparent",
    "--sjs2-base-unit-font-size": "6.8px",
    "--sjs2-base-unit-line-height": "6.8px",
    "--sjs2-typography-line-height-component-header-title": "30px",
    "--sjs2-typography-font-weight-component-header-title": "700",
    "--sjs2-typography-font-size-component-header-description": "20px",
    "--sjs2-typography-font-weight-component-page-title": "700"
  },
  "headerView": "advanced"
};
```

### `package.json`

```json
{
  "dependencies": {
    "jquery": "latest",
    "survey-core": "latest",
    "survey-js-ui": "latest"
  }
}
```

## Other Frameworks

- [Angular](https://surveyjs.io/form-library/examples/popup-survey/angular.md)
- [React](https://surveyjs.io/form-library/examples/popup-survey/reactjs.md)
- [Vue 3](https://surveyjs.io/form-library/examples/popup-survey/vue3js.md)
- [Vanilla JS](https://surveyjs.io/form-library/examples/popup-survey/vanillajs.md)
