You're getting all the content because when you put $('.insert').text()
you get the text of all elements with .insert class.
It works if you do a click event:
$(".insert").click(function(){
var conteudo = $(this).text();
});
That way it gets the text where you clicked.
To do the click function it's just the same, and it works normal inside $ (document) .ready. The syntax is
$("seletor").click(function(){
// o que acontece ao clicar
});
As you may have noticed with the first example I gave, hehe. If you are going to use this within the insertDado()
function, you have to execute this function after setting, just writing insertDado()
within $(document).ready
.
I hope you did not get too confused.