I have a tag with the class "mpIt mpId456" inside this tag I need to create a tag. How can I do this?

  • 0
    Is it possible to somehow access the tag with the "mpIt mpId456" class and create another
    • tag inside this tag.
      Thanks in advance for your help. In the photo, I showed you where to create a tag using javascript.
    JavaScript Anonymous, Oct 22, 2020

  • 2 Answers
  • 0
    document.querySelector('.mpIt.mpId456').insertAdjacentHTML('beforeend', `<b>тег "b"</b>`);
    Anonymous

  • 0
    let curEl=document.getElementsByClassName("mpIt mpId456")[0]
    let newTag=document.createElement(newTageName)
    curEl.appendChild(newTag)
    Anonymous

Your Answer
To place the code, please use CodePen or similar tool. Thanks you!