There are two paragraphs, conditionally A and B, only when you click on the upper block, on the paragraph itself it changes places with the lower one, that is, only the upper one is clickable. always top

Closed due to the fact that the essence of the issue is not clear to the participants Enikeyschik , 0xdb , Air , aleksandr barakin , Sergey Glazirin Feb. 27 at 4:35 .

Try to write more detailed questions. To get an answer, explain what exactly you see the problem, how to reproduce it, what you want to get as a result, etc. Give an example that clearly demonstrates the problem. If the question can be reformulated according to the rules set out in the certificate , edit it .

  • one
    Is there a question somewhere? Or why is this incomprehensible description of two paragraphs? - Enikeyschik
  • how to do it ? - Jack Bill

1 answer 1

A bit of minimalism: D

document.querySelector('section').addEventListener('click', function (e) { this !== e.target && this.appendChild(e.target) }) 
 <section> <p>A</p> <p>B</p> </section>