In Short, I am currently showing a list of results... and then I place a filter on the results and pulls another list of results, using the .live() within jQuery.
Not my problem comes when i'm using qTip. Which currently runs somewhat like this... without all the details.
$('.contact').each(function() {
$(this).qtip({
// These are my options within here
});
});
This if my code for filtering my results 开发者_如何学Pythonusing the .live() feature.
$('.filterContacts').live('click', function(){
var filterId = $(this).attr('id');
$.ajax({
url: 'classes/class.Post.php?a=filterContacts',
dataType: 'html',
data: {
filter: filterId
},
success: function (responseText) {
$(".contacts").html(responseText);
},
error: function() {
alert("Oops... Looks like we're having some difficulties.");
}
});
return false;
});
So now my qTip doesn't like to work on my filtered results... is there anything that I am able to do? Any help would be appreciative!
UPDATE: .contacts is a div that surrounds all of the .contact divs. IE:
<div class="contacts">
<div class="contact">FistName, LastName</div>
<div class="contact">FistName, LastName</div>
<div class="contact">FistName, LastName</div>
</div>
you should execute your code in the success block.
$('.filterContacts').live('click', function(){
var filterId = $(this).attr('id');
$.ajax({
url: 'classes/class.Post.php?a=filterContacts',
dataType: 'html',
data: {
filter: filterId
},
success: function (responseText) {
$(".contacts").html(responseText);
// call your each function here...
$('.contact').each(function() {
$(this).qtip({
// These are my options within here
});
});
},
error: function() {
alert("Oops... Looks like we're having some difficulties.");
}
});
return false;
});
精彩评论