iframe, then legal.js must be included in the HTML of the
iframe, otherwise legal.js will not be available there.
Document.querySelector()method in your browser console, passing it the same selector that you intend to pass to
targetElementSelectorand verifying that the matched element is the one you expect. Note that, if your form is in an
iframe, you will need to run this test in the console of the
iframe, not the console of the surrounding page.
<div>as the target element, whose
idattribute is set to
<div>element as shown here.
legal.widget()offers an option to add the widget before or after an existing target element that you choose.
target-element-idand replaces that element with the widget:
insertModeoption to change how and where the widget is placed in relation to the target element, like so:
identifieroption with your unique identifier as its value. Here is an example of identifying your user when calling
emailInputSelectoroptions, respectively. This naturally assumes that your form contains input fields for name and email address.
legal.user()method lets you attach a full name and an email address to the current user independently of collecting consent. When using this method, the user will be updated in our system with the name and email you define.
legal.load()as shown below.
legal.user()is useful if the user changes their email address or their name.
forattribute with a value corresponding to the label's
span) acting as labels that have an
idattribute corresponding to an
aria-labelledbyattribute on the checkbox.
legalmonster-consenthas a value of
on, the default value of a checkbox.
submitButtonSelectorsoption you can provide a standard CSS selector that matches only the button, or buttons, that legal.js should watch.
Document.querySelectorAll()method internally, and it supports any element, so you can target clickable non-button elements if you use those instead of standard buttons to submit your form.
submitButtonSelectorsoption, legal.js will watch only the elements that are matched by the selectors you provide, and will not include your form's default submit buttons if they do not match.
submitButtonSelectorsoption to an appropriate CSS selector, you can target only the button (or buttons) that legal.js should watch:
submitButtonSelectorsan appropriate selector like so:
submitButtonSelectorsoption match only the buttons you want legal.js to watch, and that they match all of them.
Document.querySelectorAll()method in your browser console, passing it the same selectors that you intend to pass to
submitButtonSelectorsand verifying that the list of matched elements is what you expect.