On 13 Okt., 02:42, kneidels <[EMAIL PROTECTED]> wrote:
> this didnt seem to work for me, what am i doing wrong:
>
> this is my text link:
>
> [<a href="tblApplicantsView.asp?ApplicantID=1#ui-tabs-27"
> id="commLink">view
>     Comments</a>]
>
> and here is my tab code:
>
> <script src="/includes/ui.tabs.pack.js" type="text/javascript"></
> script>
>
> <script type="text/javascript">jQuery.noConflict();
> //<![CDATA[
> (function($) {
>         $(function() {
>         $('.tabData > ul').tabs();
>         $('#toolBox > a.nyroModal').nyroModal();
>    });
>
>    $('#commLink').click(function() { // bind click event to link
>     $tabs.tabs('select', 12); // switch to third tab
>     return false;
>
> });
> })(jQuery);
>
> //]]>
> </script>
>
> Many thanks!

You're doing a couple of things wrong.

* You're referencing a variable that isn't defined ($tabs).
* You're trying to attach a click event outside the DOM ready handler,
which will only work if you use the bottom-script approach. But as
you're using a DOM ready handler already I assume that is just a
mistake. At the point of time of execution $('#commLink') won't match
anything.
* Probably it's just a typo, but if you want to select the third tab,
select 2 not 12.
* It's not really wrong but I moved the noConflict statement into the
CDATA block.

<script type="text/javascript">
//<![CDATA[
jQuery.noConflict();

(function($) {
    $(function() {
        var $tabs = $('.tabData > ul').tabs(); // <= Here I've added
the assignment for $tabs

        $('#commLink').click(function() { // bind click event to link
            $tabs.tabs('select', 2); // switch to third tab
            return false;
        });

        $('#toolBox > a.nyroModal').nyroModal();
    });
})(jQuery);

//]]>
</script>

By the way: I also fixed indentation and rearranged the code. Please
have in mind that it's always easier for the ones willing to help to
read (and understand) code that is properly indented. In the end
you're doing yourself a favor if you properly indent code (even if you
don't have to post it here and ask for help).

HTH, --Klaus


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"jQuery UI" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/jquery-ui?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to