HTML Field
SurveyJS Form Library includes a multitude of built-in functionalities, offering extensive flexibility to create virtually any design for your forms. In cases where the Form Library falls short, unable to fulfill specific requirements, you have the option to leverage custom HTML markup. With the use of HTML markup, you can implement a sophisticated layout, seamlessly integrate custom text, images, hyperlinks, or any other content into your survey. Try out this interactive demo—utilize a dedicated multiline input field to enter custom HTML markup and see how this markup is rendered within your form.
To create an HTML form field, define an object with the type
property set to "html"
and add it to the elements
array. Within this object, specify a unique name
that identifies this element and assign your HTML markup to the html
property.
SurveyJS Form Library doesn't perform HTML sanitization. If you are not in full control of the HTML markup (for instance, if you are obtaining it from a third party), encode it using a sanitizing tool of your preference within the
onProcessHtml
event handler. This will help ensure against possible XSS attacks.