Hi I have a ul and that ul is populated through ajax request. Now I want to trigger a functiont whenever the content is placed or changed in that ul
. My ul is like this
<ul class="prodListing" id="prodListing"></ul>
I have tried .bind()
function with contentchange
like this
$(".prodListing").bind('contentchange', function() {
alert("called");
show_Socialshare();
});
And also tried
$(".prodListing").change(function(){
alert("called");
show_Socialshare();
});
But both are not working. Can any body tell me how can I fire the function on this event
Contentchange isn't a real event, but if you know the places where your content changes you can trigger it as a custom event.
$(".prodListing").trigger("contentchange")
Update: However handling this in the onsucces of your ajaxrequest is indeed probably what you need.(see other comment)
You could use:
$(document).bind('ajaxComplete', function(){
alert("called");
show_Socialshare();
});
This will watch the document for any ajax calls and run once it's complete.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.