• I’m having trouble with WP stripping JS from my page content. I’m wanting to use the following code as part of my Mailchimp opt in, and the JS is getting stripped. It works in preview mode but the moment I update the page the code disappears. I’ve been searching for over an hour for a solution and can’t find one!

    <input id=”mce-FNAME” class=”required” name=”FNAME” type=”text” value=”First name” onfocus=”if(this.value==this.defaultValue)this.value=”;” onblur=”if(this.value==”)this.value=this.defaultValue;”/>

Viewing 2 replies - 1 through 2 (of 2 total)
  • Are you writing that code from the Page Editor?

    Then it will get striped as WP doesn’t allows script tag for security reasons.

    You have to write the code in page.php

    Or you may create a custom page template.

    Also try googling on how to enqueue a JS file with WP

    Thank you

    Thread Starter bobschwenkler

    (@bobschwenkler)

    Yes, from the page editor.

    Thanks for the pointers!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Trouble adding inline JS in page content’ is closed to new replies.