Thanks MorningZ.. But, it "appears" that your script is missing syntax
somewhere....I do not know enough about javascript to find the error.
Any ideas why it's not showing as valid?
$(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;
}
});
});
Follow up question: What does the <a href> mark up need to look like?
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 100 tabs
>
> $(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 to link
> > $tabs.tabs('select', 0); // switch to first tab
> > return false;
> > });});
>
> > $(document).ready(function(){
> > var $tabs = $("#tabs").tabs();
> > $('#link1').click(function() { // bind click event to link
> > $tabs.tabs('select', 1); // switch to second tab
> > return false;
> > });});
>
> > $(document).ready(function(){
> > var $tabs = $("#tabs").tabs();
> > $('#link2').click(function() { // bind click event to link
> > $tabs.tabs('select', 2); // switch to third tab
> > return false;
> > });});
>
> > $(document).ready(function(){
> > var $tabs = $("#tabs").tabs();
> > $('#link3').click(function() { // bind click event to link
> > $tabs.tabs('select', 3); // switch to fourth tab
> > return false;
> > });});
>
> > $(document).ready(function(){
> > var $tabs = $("#tabs").tabs();
> > $('#link4').click(function() { // bind click event to link
> > $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 the tabs.
>
> > <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 -