Disappearing JavaScript (2 posts)

  1. jockoe
    Posted 6 years ago #

    I've created an external javascript file (xxx.js) so that I can use javascript on some of my pages. I put the link into the header.php file like the codex says and uploaded the file. I used

    <script src="absolute_path"/xxx.js"></script>

    The call I used was

    onchange="hideFld()" (with the <SELECT> tag)

    It is used on a FORM. (I am using Matt Wright's FormMail.pl to process my forms) When I test it on the page at http://www.tracyandcarol.com/the_tracy_times/why_im_blogging/contact_us/, it does not work. When I go into the page's HTML the call is not there anymore.

    I've verified that the code works by linking the external file to a regular HTML page.

    Can anybody tell me where I am going wrong?

  2. stvwlf
    Posted 6 years ago #

    using form HTML code can be problematic in WP posts. If this is just one page you need the form on, I suggest using a custom page template. Enter the form code and javascript onchange in the PHP file of the custom template rather than in the WP post

    In that file you can enter any code you care to.

Topic Closed

This topic has been closed to new replies.

About this Topic


No tags yet.