diff --git a/addons/website/static/src/snippets/s_website_form/options.js b/addons/website/static/src/snippets/s_website_form/options.js
index f019e578e55eebadad2e7425c83e68ffaae8c1c1..06e8cd18f91e80097567c1b94579af6bd12d1bca 100644
--- a/addons/website/static/src/snippets/s_website_form/options.js
+++ b/addons/website/static/src/snippets/s_website_form/options.js
@@ -105,13 +105,16 @@ const FormEditor = options.Class.extend({
      * Replace all `"` character by `"`, all `'` character by `'` and
      * all "`" character by `‘`. This is needed in order to be able to
      * perform querySelector of this type: `querySelector(`[name="${name}"]`)`.
+     * It also encodes the "\\" sequence to avoid having to escape it when doing
+     * a `querySelector`.
      *
      * @param {string} name
      */
     _getQuotesEncodedName(name) {
         return name.replaceAll(/"/g, character => `"`)
                    .replaceAll(/'/g, character => `'`)
-                   .replaceAll(/`/g, character => `‘`);
+                   .replaceAll(/`/g, character => `‘`)
+                   .replaceAll("\\", character => `\`);
     },
     /**
      * @private
diff --git a/addons/website/static/tests/tours/website_form_editor.js b/addons/website/static/tests/tours/website_form_editor.js
index e07adbda6719e5a7ffe87d7097e77693d0b632b3..520f11a7385343623f19395404d97c737bc10a7a 100644
--- a/addons/website/static/tests/tours/website_form_editor.js
+++ b/addons/website/static/tests/tours/website_form_editor.js
@@ -33,7 +33,8 @@ odoo.define('website.tour.form_editor', function (require) {
     const getQuotesEncodedName = function (name) {
             return name.replaceAll(/"/g, character => `"`)
                        .replaceAll(/'/g, character => `'`)
-                       .replaceAll(/`/g, character => `‘`);
+                       .replaceAll(/`/g, character => `‘`)
+                       .replaceAll("\\", character => `\`);
     };
 
     const triggerFieldByLabel = (label) => {
@@ -110,6 +111,9 @@ odoo.define('website.tour.form_editor', function (require) {
             let inputType = type === 'textarea' ? type : `input[type="${type}"]`;
             const nameAttribute = isCustom && label ? getQuotesEncodedName(label) : name;
             testText += `:has(${inputType}[name="${nameAttribute}"]${required ? "[required]" : ""})`;
+            // Because 'testText' will be used as selector to verify the content
+            // of the label, the `\` character needs to be escaped.
+            testText = testText.replaceAll("\\", "\\\\");
         }
         ret.push({
             content: "Check the resulting field",
@@ -496,9 +500,12 @@ odoo.define('website.tour.form_editor', function (require) {
             trigger: '[data-field-name="email_to"] input',
             run: 'text test@test.test',
         },
+        // The next four calls to "addCustomField" are there to ensure such
+        // characters do not make the form editor crash.
         ...addCustomField("char", "text", "''", false),
         ...addCustomField("char", "text", '""', false),
         ...addCustomField("char", "text", "``", false),
+        ...addCustomField("char", "text", "\\", false),
         {
             content: 'Save the page',
             trigger: 'button[data-action=save]',