title: How add ID element to the specific class line?
body: <p>I would like to add an ID to a line that contains a class with the specified name. eg. If the website will block "div" or "li" that contains a class with names such as "name-1 name-2 name-3"  This function detects a class called "name-1" and insert element id="menu" that the line looks like this: . Can you help?
  I tried that:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div class="menu-item menu-item-object-custom menu-item-has-children"&gt;
  I am a DIV or LI element
  &lt;/div&gt;
  
  &lt;button onclick="myFunction2()"&gt;Try it&lt;/button&gt;
  
  &lt;script&gt;
  function myFunction2() {
      var x = document.getElementsByClassName("menu-item-has-children")[0];
          x.document.createElement("id");
  }
  &lt;/script&gt;</code></pre>
  </div>
  </div>
  </p>