how do you use a custom function with jquery .live()? -


i have page has haschhange tabs when click on link url looks www.site.com/abc.php#123.php

but because of functions don't work.

i have page specific script works if go www.site.com/123.php. won't work when page loaded in via ajax hashchange plugin.

i thinking needed use .live() when page loads capture new content... hmmmm

is there way of doing this?

i'm trying run code on 123.php page:

$(".tab_content").hide(); //hide content $("#files_left_pane > ul.tabs li:first").addclass("active").show(); //activate first tab $("#files_right_pane > .tab_content:first").show(); //show first tab content //on click event $("#files_left_pane > ul.tabs li").click(function() { $("#files_left_pane > ul.tabs li").removeclass("active"); //remove "active" class $(this).addclass("active"); //add "active" class selected tab $("#files_right_pane > .tab_content").hide(); //hide tab content

var activetab = $(this).find("a").attr("href"); //find href attribute value identify active tab + content $(activetab).fadein(); //fade in active id content return false; });

update:

i have tried wrap script in $(selector).live('click', function(){}); i'm noticing js place in 123.php won't excecuted once loaded via hashchange

update: nevermind, had run function in code initiated haschange , loaded in content via ajax.

thanks prodigitalson

i j define code youve provided function , use function art of success callback ajax:

function updatetabs(){   // code provided }  // exmaple ajax call:  $.get(theurl, function(){   // other logic need    updatetabs(); }); 

this allows reuse code after/bfore number of operations. dont think live issue hear because want run after youve appended new content dom content isnt unique single specific element being added can tell.


Comments

Popular posts from this blog

Add email recipient to all new Trac tickets -

400 Bad Request on Apache/PHP AddHandler wrapper -

php - Change action and image src url's with jQuery -