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 e40f0340ad245508923f3f0bd6e8ada17d416f3a..0a6366aee30729afa535ee43b7252986666fd4db 100644
--- a/addons/website/static/src/snippets/s_website_form/options.js
+++ b/addons/website/static/src/snippets/s_website_form/options.js
@@ -118,13 +118,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 544934dae88ed2da71b901c8c30f8e1766f54b3a..baa4712c909addae999859c070445c8fddef871e 100644
--- a/addons/website/static/tests/tours/website_form_editor.js
+++ b/addons/website/static/tests/tours/website_form_editor.js
@@ -34,7 +34,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 getFieldByLabel = (label) => {
@@ -111,6 +112,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",
@@ -517,9 +521,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]',