N
N
ninja op op2020-04-21 14:19:02
JavaScript
ninja op op, 2020-04-21 14:19:02

How to get the value of p object inside this?

There is the following code:

<div onClick="notifyLol()">
<p>Хоп хей лалалей</p>
</div>
<div onClick="notifyLol()">
<p>Жымжым</p>
</div>
<div onClick="notifyLol()">
<p>Кукареку</p>
</div>

<script>
function notifyLol(){
  alert("Ваше сообщение" + $(this > p).text());
}
</script>


But it doesn't work. Who knows how this can be done? It is necessary exclusively through this.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Roman Sarvarov, 2020-04-21
@kur4chyt

alert("Ваше сообщение" + $(this).find('> p').text());

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question