Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

176
Views
"invalid_elements" not working when we have "valid_elements" in Tinymce

I have a scenario in which we have defined valid and invalid elements in Tinymce. Below are the values of these two:

invalid_elements: 'script',
valid_elements: '*[*]',

"invalid_elements" is to prevent JavaScript to be entered. With above settings, Tinymce is not preventing JavaScript but if I remove "valid_elements" then it starts working.

I am not sure if I remove "valid_elements" still Tinymce will allow everything and that's why keeping "valid_element".

Tinymce version: 5.6.2

Related question but not helping in my scenario: Disable Javascript in TinyMCE

Working Fiddle: https://fiddle.tiny.cloud/WRhaab/2

Is there any way by which I can keep "valid_elements" and prevent JavaScript as well?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

valid_elements and invalid_elements are not exclusive options. They can work together but can't contradict each other.

When you are setting valid_elements to '*[*]', it means all elements are allowed. If all elements are valid, scripts are valid too. That's why if you remove the valid_elements option, invalid_elements starts working.

If you are not sure some elements would stay valid if valid_elements: '*[*]' is removed, you can check HTML 5 and HTML 4 specifications since by default TinyMCE allows all elements specified by these standards. You can use the schema option to switch between different standards.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!