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 <[email protected]> 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 <[email protected]> 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 -