I have been developing both client and personal websites in Webflow for many years now. The amount of heavy lifting it does through its visual UI is unbelievable. I have experimented with moving to hand-coding websites a few times since starting this journey and always find myself back in the Webflow designer within a couple hours. The speed and efficiency it provides me with is just too good to say no to.
Here comes the “but”! As good as Webflow is, it does have its limitations. These limitations are no problem at all to someone proficient in JavaScript. Just one problem, I, along with many other skilled Webflow developers simply suck at writing JavaScript. Only because we don’t do it often enough to write it with confidence!
Thanks to all of the hype on Twitter surrounding ChatGPT and OpenAI, I recently discovered the Codex Javascript Sandbox and I think us Webflow people may well have a new superpower in our hands. It’s early days and I haven’t had as much time as I would have liked to test it. I do think however that it is a tool every Webflow developer regularly reaching into StackOverflow for hours on end for some simple JavaScript guidance should be looking into. Here’s why:
Now bare in mind I am actually speaking about my usual custom code process here, but having spoken to many Webflow developers about this issue, it seems that most of us have a similar process and it looks something like this:
So no biggie, mission accomplished and you have everything working the way you need it to. Avoiding that extra couple hours of StackOverflow scrolling though would have been first prize. I used the OpenAI Codex Sandbox multiple times this week to do just that.
The OpenAI Codex is an AI system that translates natural language into code. Simply put, you tell the system what you need your code to do and it writes the code for you. I played around with the Codex sample application, the Code Javascript Sandbox this week and was amazed by the results. So long as I could (somewhat) clearly explain what I needed my code to do in plain language, it would provide me with my code in seconds, saving me a lot of StackOverflow scrolling.
I am by no means saying that this tool is a replacement for true JavaScript coding skills, but for us No-Code people who are only writing a script every now and then, it looks to be incredibly powerful. I have put together an example Webflow use case below.
To better illustrate how this could fit into your workflow I have created a very simple example showing a Webflow challenge that requires custom code to get around and how I resolved it using the OpenAI Codex.
Here we have a list of fishing reels, ordered by rating score in the green block from highest to lowest. All data here is being pulled from a Webflow collection list through the Webflow CMS.
The problem we have here is that while we can order the fishing reels from highest to lowest dynamically through Webflow collection list settings, we can’t dynamically update the ranking numbers highlighted in red.
We could allocate a “ranking number” field to each reel item in the CMS and pull the number through that way, but this is messy. Additionally this list needs to dynamic in the sense that if a reel’s rating score changes, its position in the list should update automatically. It’s associated ranking number should follow suit.
We need some JavaScript that will cycle through each CMS item in this list, target each respective rating number and update it based on its index position within the list. That way the ranking number of the first item would be 1, second item would be 2 and so on…
So we have two key elements to target here. We need to loop through each “buyers-guide_top-item” and based on its position in the list, update the number value of its “ranking-number”.
Now that we know what we need to do, its time to open the Codex JavaScript Sandbox and get our code. This tool has a very simple interface and we only need to worry about two elements. The instructions input where we will be writing our request and the code output panel (where our code will be output).
All that is left to do is provide the codex with instructions and watch the magic unfold as code is generated in front of you. Based on the requirements above I am going to provide the following instructions:
“For each element with class name “buyers-guide_top-item”, update the html of its child with class name “ranking number” to match the index of this “buyers-guide_top-item”.”
The instructions input:
The code generated:
And there we have it. Based on the instructions provided we now have a script that will do the following:
Remember that as with all custom JavaScript on Webflow, you will only see the working results on the published site so let’s see how it looks.
How it looks on the published site:
And there we have it, the position of each reel item is now automatically reflected in the rating number on the left hand side.
There is no substitute for true coding skills and learning real JavaScript proficiency but if you are a Webflow developer like me who:
Well in that case I would definitely recommend taking a look at Codex Javascript Sandbox . It will save you time, give you confidence and help you develop your JS skill faster.