How do I allow javascript to pass through unchanged? asText?

I want the ability for my content writers to enter something like

<script>alert('Hello world!')</script>

in the dashboard and have that passed through and executed on the resulting page?

Would asText be the right thing to use for this?

Hey, @tech-account welcome to the Community!

You can add a custom field to allow `preformatted text in your Custom Types. Then you'll need to parse the response to parse the string that the result retrieves into code:

Thanks! I think that's what our developers set up, and it's working as expected for html tags (<p> <div> <style> etc. etc.).

<script> tags are visible in the Chrome inspector, but it doesn't seem like they are getting executed.

Ok, I see. If the response from the API is correct and they are parsing and displaying the script, then it's something that needs to be solved in the Front-End of the project using JavaScript to trigger the event correctly.

This issue has been closed due to inactivity. Flag to reopen.