<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<div id="wrap">
    <p>qqq</p>
    <p>www</p>
    <p>eee</p>
</div>
<script>
    let oWrap = document.querySelectorAll('#wrap p');
    for (let i=0;i<oWrap.length;i++){
        oWrap[i].onclick = function () {
            console.log(oWrap[i].innerHTML);
        }
    }
</script>
</body>
</html>