diff --git a/examples/survey-ui/index.js b/examples/survey-ui/index.js index eff43bd3ef..686f417d22 100644 --- a/examples/survey-ui/index.js +++ b/examples/survey-ui/index.js @@ -976,7 +976,8 @@ function init() { "result: " + JSON.stringify(result.data); }); - SurveyUI.renderSurvey(survey, document.getElementById("surveyElement")); + // SurveyUI.renderSurvey(survey, document.getElementById("surveyElement")); + survey.render(document.getElementById("surveyElement")); } if (!window["%hammerhead%"]) { diff --git a/src/entries/jquery-ui.ts b/src/entries/jquery-ui.ts index 78c5542138..724cfa06bf 100644 --- a/src/entries/jquery-ui.ts +++ b/src/entries/jquery-ui.ts @@ -26,6 +26,14 @@ function doPopupSurvey(props: any): void { } SurveyModel.platform = "jquery"; +SurveyModel.prototype["render"] = function (element: any = null) { + if (this.renderCallback) { + this.renderCallback(); + } else { + const survey = React.createElement(Survey, { model: this }); + ReactDOM.render(survey, element); + } +}; export const preact: any = React; diff --git a/src/entries/ui.ts b/src/entries/ui.ts index 736762170e..52c79c4e10 100644 --- a/src/entries/ui.ts +++ b/src/entries/ui.ts @@ -36,6 +36,13 @@ if (!!jQuery) { } SurveyModel.platform = "ui"; +SurveyModel.prototype["render"] = function (element: any = null) { + if (this.renderCallback) { + this.renderCallback(); + } else { + renderSurvey(this, element); + } +}; export const preact: any = React;