header-logo
Learn how to use Wix to build your site and business.
Design and manage your site using intuitive Wix features.
Manage subscriptions, plans and invoices.
Run your business and connect with members.
Learn to purchase, connect or transfer a domain to your site.
Get tools to grow your business and web presence.
Boost your visibility with SEO and marketing tools.
Get advanced features to help you work more efficiently.
Find solutions, learn about known issues or contact us.
placeholder-preview-image
Improve your skills with our courses and tutorials.
Get tips for web design, marketing and more.
Learn to increase organic site traffic from search engines.
Build a custom site using our full-stack platform.
Get matched with a specialist to help you reach your goals.
placeholder-preview-image

Studio Editor: Using the AI Assistant to Add Custom Code

6 min
In this article
  • Adding custom behavior with AI
  • Reverting code changes done by AI
  • FAQs
Currently, this feature is in alpha mode.
Add custom code behaviors to elements, without any coding experience, using our AI assistant. Whether you're enhancing interactivity or creating tailored experiences, AI makes it simple. Focus on your creative vision while the assistant handles the technical coding, offering suggestions or implementing your own ideas.
excerpt from a conversation with the AI assistant after it generated custom code, disabling a button for visitors in germany

Adding custom behavior with AI

Access the AI assistant from the Code panel, or right-click the specific element you want to customize. The assistant will send an initial message on your behalf – ‘What interactive behavior can you apply to (element ID)?’— and offer tailored suggestions based on the element.
Pick a suggested behavior or describe the customization you have in mind. You’ll always have the chance to preview and approve the code before it’s added to your client’s site.

To add custom behavior with AI:

  1. Go to your editor.
  2. Right-click the relevant element.
  3. Select Add Custom Behavior with AI.
    Tip: This opens the chat with the AI assistant (within the Code panel) on the left side of the editor. 
  4. Review the AI assistant's suggestions for custom behaviors it can add.
  5. Describe what you want to customize and click the Send icon .
    Tip: It doesn't have to be one of the suggestions if you had a different idea in mind. The AI assistant will evaluate and advise if it can add the customization you're thinking of. 
  6. Choose what to do next:
    • Refine the customization: Continue chatting to the AI assistant to clarify the specific customization you want it to add. 
    • Preview the code: Click Show code to see the code AI intends to add. It also provides a breakdown of what the code does, clarifying how it applies the customization. 
    • Add the code: Add the code to your client's site.
      1. Click Add code.  
      2. Click Approve to confirm adding the code.
What's next?
  • Click Preview under Generated Code to see how your customization looks. 
  • You can always click the New Chat icon  to start a conversation about another customization you want AI to make.  
Conversation with the AI assistant, showing the end where it generated code that disables a button for visitors from germany

Reverting code changes done by AI

Restore your client's site to its previous state if you want to undo changes made by the AI assistant. You can access your chat history with the assistant and revert any generated code back to an earlier version.

To restore the code to the previous state:

  1. Go to your editor.
  2. Click Code undefined on the left side of the editor.
  3. Click AI Assistant
  4. Click the More Actions icon  at the top right of the code panel.
  5. Select Show chat history.
the AI assistant in the code panel, cursor clicking the more actions icon and selecting the 'show chat history' option
  1. Select the relevant conversation.
  2. Click Restore under the relevant Generated Code section.
Part of a previous chat with the AI assistant, showing the generated code section and the restore button

FAQs

Click a question below to learn more.