I have a small problem with Jquery click. On page load we display some things from a database. The startup code I mean is placed in the same file where the html is (This will be removed when the user searches for the first time because the div where are the list-item are in wil be cleared after searching to make place for the search results).
When you click on one of the items you get a popup menu with some info.
Now the problem:
On the page we also have a search bar that searches things in a database. When you press search you get a list of search result. It is the same html code as on the page load but this time Jquery don't detect a click.
html:
<div class="list-item" data-singer= <?php echo '"'.$name.'"' ?> >
<div class="row">
<div class="name"><?php echo $name ?></div>
<div class="tags">
<div class="tag"><?php echo $tag ?></div>
</div>
</div>
<div class="row">
other info
</div>
</div>
Jquery:
$('.list-item').click(function(){
alert();
name = $(this).data('singer');
name_modified = name.replace(" ", "_");
$(name_modified).ready(function(){
$('.popup > .content').empty();
$('.popup > .content').load('singers/' + name_modified + '.xml');
$('.popup').slideDown(500);
});
});
There is also another problem with the js code but I am already happy when I fix this problem. When you need more information leave a comment and I will add it.
And a message to downvoters. Leave a comment please.