javascript - function inside page not working correctly after using load() jquery -


im using jquery tab example
have index.php

<div id="content"></div> 

and custom.js : load page.php only after navigation click, default #content blank

$(function() {     $('#tabs').tabs(); }); // clicked event below $('#content').load(page.php) // load when clicked 

page.php : page.php load tabs inside page not displaying correctly , function not working because im using .load()

<div id="tabs"> tabs data etc.. </div> 

so question is:
1. there way reload custom.js(file) after using .load() function? or
2. there way without writing bunch of jquery code script tag on page.php? or
3. there better way doing this?

you trigger event in load callback , listen in document ready.

$(function(){     $(document).on('contentsloadedevent', function(){         $('#tabs').tabs();     }); });  $('#contents').load('http://localhost/page.php', function() {     $(document).trigger($.event('contentsloadedevent')); }); 

Comments

Popular posts from this blog

c# - Binding a comma separated list to a List<int> in asp.net web api -

Delphi 7 and decode UTF-8 base64 -

html - Is there any way to exclude a single element from the style? (Bootstrap) -