I have come across a problem when working with JSON and making structured content after that.
The thing is that the only HTML of a panel is this:
<div class="users">
<center>loading</center>
<script>update_users();</script>
</div>
But after downloading the information with JSON it ends up with something like that:
<div class="users">
<p class="name">User1</p>
<div class="detailed">
<span>Entry1: value1</span>
</div>
</div>
The thing is that, in my case for example, I want detailed to be toggle();
as display:none
should be the default value but Jquery doesn't want to select that new content.
//does work
$(".users").click(function(){
$(".users .detailed").toggle();
});
//doesn't work
$(".users .name").click(function(){
$(".users .detailed").toggle();
});
How can I solve the problem that Jquery doesn't work to select new content inserted to the page?