Hi guys,
I have a problem with SyntaxError: Unexpected end of the input , and it’s pointing me to this line of code: </script></head><body><div class="page-wrapper"><div class="global-styles w-embed"><style>
This is the HTML of my Embed Code block and I don’t know what the problem is, it’s written all syntax right, and I didn’t even write the code, Webflow is generating this. I put my code in some HTML Formatter and it gives me this error: Element “style” not allowed as child of element “div” in this context. (Suppressing further errors from this subtree.) .
I would appreciate some help. Thanks.
memetican
(Michael Wells)
August 18, 2024, 10:49pm
2
Hey Stefan,
You’ll need to share a link to the published page you’re having the problem on. Ideally you’ll follow the posting rules and share a link to your readonly view on that same page.
I’m assuming this is a browser error, and that most likely you have an error in your embed code that’s preventing the browser from parsing & rendering it properly.
I rewrote this code from embed in custom code in page settings, and now is showing the same error for the custom code before body…
https://preview.webflow.com/preview/airportexecutive?utm_medium=preview_link&utm_source=designer&utm_content=airportexecutive&preview=7943f4d94427cbfdc30fe978e5ea2b8e&pageId=66113eb5d77d90c9967ea13e&locale=en-GB&workflow=preview
here is the line of code: </script></head><body><div class="page-wrapper"><div class="main-wrapper"><div class="f-page-wrapper"><div class="f-main-wrapper"><div class="f-form-section"><div class="f-container-3 is--form"><div id="form" class="f-form-parent is--form w-form"><form method="post" data-query-param="true" data-form="multistep" name="wf-form-Booking" data-name="Booking" data-enter="true" id="wf-form-Booking" class="f-form is--form" data-wf-page-id="66113eb5d77d90c9967ea13e" data-wf-element-id="2f8784cc-7bbc-6d4d-805a-eda93738c1e6"><div class="logo-booking"><a href="/" target="_blank" class="logo-booking w-inline-block"><div class="lottie-animation" data-w-id="c27fb7ac-28a4-5d08-c8b9-b33a5a522a13" data-animation-type="lottie" data-src="https://cdn.prod.website-files.com/66113eb5d77d90c9967ea08c/66113eb5d77d90c9967ea12c_AE%20Animation%202%20Small%20artboard.json" data-loop="0" data-direction="1" data-autoplay="1" data-is-ix2-target="0" data-renderer="svg" data-default-duration="3.5" data-duration="0"></div></a></div><div class="f-form-steps-wrap is---2"><div data-card="true" data-form="step" class="f-form-steps-item is---2"><div class="f-steps-wrap is--1"><div class="f-w-progress-wrap"><div class="f-progress-item"><div class="progress-number_block f-progress-current-2"><div class="text-block-25">1</div></div><div class="text-size-small">Journey Info</div></div><div class="f-progress-item"><div class="progress-number_block"><div class="text-block-28">2</div></div><div class="text-size-small">Vehicle Class</div></div><div class="f-progress-item"><div class="progress-number_block"><div class="text-block-28">3</div></div><div class="text-size-small">Customer Info</div></div><div class="f-progress-item"><div class="progress-number_block"><div class="text-block-28">4</div></div><div class="text-size-small">Pickup Info</div></div><div class="f-progress-item"><div class="progress-number_block"><div class="text-block-28">5</div></div><div class="text-size-small">Payment</div></div><div class="f-progress-item"><div class="progress-number_block"><div class="text-block-28">6</div></div><div class="text-size-small">Confirm</div></div></div><div class="f-summary-card"><h5 class="heading-style-h5"><strong class="bold-text-6">Your Transfer</strong></h5><div class="f-summary-list"><div class="f-summary-item"><div class="f-summary-field-name">From<br/></div><div id="fromLocation" data-input-field="from" class="text-size-regular text-weight-semibold">Abc<br/></div></div><div class="f-summary-item"><div class="f-summary-field-name">To<br/></div><div id="toLocation" data-input-field="to" class="f-summary-text">Abc<br/></div></div><div class="f-summary-item"><div class="f-summary-field-name">Date<br/></div><div custom-date="" class="f-summary-text">Abc<br/></div></div><div class="f-summary-item"><div class="f-summary-field-name">Time<br/></div><div custom-time="" class="f-summary-text">Abc<br/></div></div></div></div><div class="f-txt-wrap is---2"><div class="f-copy-element is--form-2"></div><div class="div-block-34"><h3 class="heading-27">Journey info</h3></div><div id="yourElementId" data-distance="0" class="text-size-medium"><br/>Here's your journey on the map. Continue to Next Step for vehicle options<br/>.<br/></div></div><div class="f-2col-grid hide"><div class="f-steps-input"><label for="name-3" class="f-txt-field-label">From</label><div class="f-input-wrapper is---2"><input class="f-input-field w-input" maxlength="256" name="from" data-name="from" placeholder="Address, airport, hotel" type="text" id="from"/></div></div><div class="f-steps-input"><label for="name-3" class="f-txt-field-label">To</label><div class="f-input-wrapper"><input class="f-input-field w-input" maxlength="256" name="to" data-name="to" placeholder="Address, airport, hotel" type="text" id="to"/></div></div><div class="f-steps-input"><label for="name-3" class="f-txt-field-label">Date</label><div class="f-input-wrapper"><input class="f-input-field w-input" maxlength="256" name="date" data-name="date" placeholder="date" type="text" id="date"/></div></div><div class="f-steps-input"><label for="name-3" class="f-txt-field-label">Time</label><div data-callback="recaptcha" class="f-input-wrapper is---2"><input class="f-input-field w-input" maxlength="256" name="time" data-name="time" placeholder="time" type="text" id="time"/></div></div><div class="f-steps-input"><label for="name" class="f-txt-field-label">Distance</label><div data-callback="recaptcha" class="f-input-wrapper is---2"><input class="f-input-field w-input" maxlength="256" name="total-distance" data-name="total-distance" placeholder="distance" type="text" id="total-distance"/></div></div></div><div class="columns w-row"><div class="column w-col w-col-4"><div><div class="f-summary-field-name">Distance</div><div id="distance-value" class="text-size-regular text-weight-semibold">Abc<br/></div></div></div><div class="column-2 w-col w-col-2"><div><div class="f-summary-field-name">Duration</div><div id="duration-value" class="text-size-regular text-weight-semibold">Abc<br/></div></div></div><div class="column-3 w-col w-col-6"><div><div class="f-summary-field-name">Passengers</div><div id="passenger-value" class="text-size-regular text-weight-semibold">Abc<br/></div></div></div></div><div id="journey-map" class="f-map w-node-_10e7f15c-b978-9abf-5aa9-4cacaef881b7-967ea13e"><div class="w-embed w-script"><script async defer src="https://maps.googleapis.com/maps/api/js?key=AIzaSyDWi7eEazBBPMPLbbjmw5Rn0IZ5cY3sCX8&callback=initMap" type="text/javascript"></script>
memetican
(Michael Wells)
August 19, 2024, 11:41am
4
Ha ha that’s not particularly helpful. It’s also unclear what you mean by “a line of code”, since your HTML is starting with a closing script tag. You wouldn’t want this in an HTML embed.
^ this is what we need in order to see your error. I’m still assuming it’s a browser error, you haven’t clarified that.
Ahaa, sorry I thought you think about read-only.
Here is link to published, it’s on webflow.io because I’m testing it here:
Booking with Map
When I say a line of code, I think about where the error is pointing me.
memetican
(Michael Wells)
August 19, 2024, 12:47pm
6
Look for this part in your code, the else isn’t closed.
if (element) {
const text = element.textContent;
const c = getLastWord(text);
console.log('Country:', country);
} else {
console.log('Element not found');
Thank you so much, I was looking for error, but I couldn’t see it. Thanks.
1 Like
memetican
(Michael Wells)
August 19, 2024, 11:15pm
8
You have a LOT of code in there, and Webflow’s code editor isn’t designed as a developer IDE. I generally would pull all of that out and structure it in an external github repo.
You might have a look at Slater also, it’s a paid service but would also help you manage your code more easily.
Using TypeScript and an IDE the unclosed bracket would have been highlighted in the editor.