if your link follows the pattern of having it's ID as "linkXX" where "XX" is the zero-based index of a tab, then the live binding will "pick up" any new instances of such links in your AJAX responses/ additions
btw, i had a typo... "lit.length" should be "hit.length" On Jan 17, 11:06 am, CMI_Guy <market...@cmilc.com> wrote: > MorningZ, Thanks for your reply. Something was missing from your > syntax so I made one small change to your script: > > $(document).ready(function(){ > var $tabs = $("#tabs").tabs(); > $("a[id^='link']").live("click", function() { > var hit = this.id.match(/^link(\d+)$/); > if (hit && lit.length == 2) { > $tabs.tabs('select', hit[1]); > return false; > } > }); > > }); > > But, I must admit I know next to nothing about jquery live events. Can > you help me understand what markup I would need to put on a <a href> > link to make this script work. I would love to be able to simplify my > method for allowing text links on the page to interact with the tabs. > Much Thanks!! > > On Jan 16, 9:38 pm, MorningZ <morni...@gmail.com> wrote: > > > There's no need to repeat the code... you can even do it with ".live" > > so it'll work if there's 1 or 100tabs > > > $(document).ready(function(){ > > var $tabs= $("#tabs").tabs(); > > $('a[id^='link').live("click", function() { > > var hit = this.id.match(/^link(\d+)$/); > > if (hit && lit.length == 2) { > > $tabs.tabs('select', hit[1]); > > return false; > > } > > }); > > > }); > > > On Jan 16, 5:59 pm, CMI_Guy <market...@cmilc.com> wrote: > > > > StephenJacob, > > > > Sloppy fix. But works. > > > > <script type="text/javascript"> > > > $(document).ready(function(){ > > > var $tabs= $("#tabs").tabs(); > > > $('#link0').click(function() { // bind click event tolink > > > $tabs.tabs('select', 0); // switch to first tab > > > return false; > > > });}); > > > > $(document).ready(function(){ > > > var $tabs= $("#tabs").tabs(); > > > $('#link1').click(function() { // bind click event tolink > > > $tabs.tabs('select', 1); // switch to second tab > > > return false; > > > });}); > > > > $(document).ready(function(){ > > > var $tabs= $("#tabs").tabs(); > > > $('#link2').click(function() { // bind click event tolink > > > $tabs.tabs('select', 2); // switch to third tab > > > return false; > > > });}); > > > > $(document).ready(function(){ > > > var $tabs= $("#tabs").tabs(); > > > $('#link3').click(function() { // bind click event tolink > > > $tabs.tabs('select', 3); // switch to fourth tab > > > return false; > > > });}); > > > > $(document).ready(function(){ > > > var $tabs= $("#tabs").tabs(); > > > $('#link4').click(function() { // bind click event tolink > > > $tabs.tabs('select', 4); // switch to fifth tab > > > return false; > > > });}); > > > > </script> > > > > <div id="tabs"> > > > <ul> > > > <li><a href="users-admin.php">Administrators</a></li> > > > <li><a href="users-standard.php">Users</a></li> > > > <li><a href="users-notify.php">Process Users</a></li> > > > <li><a href="users-activity.php">User Activity</a></li> > > > <li><a href="db-backup.php">Database Backup</a></li> > > > </ul> > > > </div> > > > > TEXT LINKS elsewhere on page that activate thetabs. > > > > <a href="users-standard.php" id="link0">Administrators</a> > > > <a href="users-standard.php" id="link1">Users</a> > > > <a href="users-notify.php" id="link2">Process Users</a> > > > <a href="users-activity.php" id="link3">User Activity</a> > > > <a href="db-backup.php" id="link4>Database Backup</a>- Hide quoted text - > > > - Show quoted text -