Help with JS code placement

Need a little help with a potential project. I embeded this JS powered HTML contact form in Webflow via HTML embed component, and I tried sticking the JS on three places (site, page, and embed levels) it doesnt seem to be functioning correctly (I wrapped correctly I think)

  1. I’m assuming the JS script may be conflicting with webflow’s JS…but I don’t know enough to confirm or edit. (I’m assuming this is the case because the “Next” button isn’t functional)

  2. Here’s the Webflow link (please see the “test” page): https://preview.webflow.com/preview/rewirekb?preview=695c84fe11c309622d1af87b133a2749

  3. HTML Embed is on 你的店会生意兴隆的-官场小说阅读网 (I’m using one of my older projects to demo this embed first before I start a new project. )

  4. JS script via Codepen: https://codepen.io/erizzl/pen/ypPmja

Is it possible to make this work in a Webflow embed component?

thanks for reading!

1 Like

You did not include jquery a second time. That’s good.

All custom JavaScript must be in the page or site footer, unless you know what you’re doing.

Your codepen also had an external resource (other than jquery) that you should include in the page footer, just before your code.

2 Likes

Thanks so much for the reply! What do you mean by “page footer?” Is that the “Before body tag” section under page settings? or are we talking about a footer component on the actual page?

What is the correct way to include the 2nd source in the page footer?
I assume you’re talking about: //cdnjs.cloudflare.com/ajax/libs/jquery-easing/1.3/jquery.easing.min.js

is there some syntax needed to reference that URL, or do I need to copy that whole script into the footer?

I’m in the same situation than you.
I use a local js for forms, work fine but at the time you submit the form never send the email.
i think the webflow.js may conflicting with my js file because in other html page works perfectly.
:frowning:

My code have a Local JS
(js/handledforms.js)
must be in the footer page too??
Thanks :slight_smile:

Yes this is also called the page footer code field.

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-easing/1.3/jquery.easing.min.js"></script>
1 Like

2 posts were split to a new topic: How to use PHP code in Webflow