Jquery-please explain code

zachvaldez
zachvaldez used Ask the Experts™
on
I was researching how to stay in same tab after click  on my code behind button and I came across these 2 possible solutions but
implementing causes a javascript runtime error
'Object expected'

1)          $($respTabs.find('.resp-tab-item.' + options.tabidentify)[tabNum]).addClass('resp-tab-                     active').css({
                'background-color': options.activetab_bg,
                'border-color': options.active_border_color
            });

Open in new window


2)
        $(document).ready(function () {
            $("#HorizontalTab").bind('tabsselect', function (event, ui) {
                window.location.href = ui.tab;
            });
        });

Open in new window


These are jquery codes and maybe the jquery and javaScript experts can help read and implement these correctly what it does. Thanks
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Most Valuable Expert 2017
Distinguished Expert 2018
Commented:
The first set searches through whatever has been loaded into $respTabs for an element with class
.resp-tab-item.' + options.tabidentify)
This returns an array so the [tabNum] specifies which of the returned elements you are interested in.
To this the class resp-tab-active is added and the CSS background colour and border colour for the selected element are changed

In the second snippet you are binding an event handler to the tabsselect event issued within the element with id #HorizontalTab - and changing the URL of the active window to the tab value passed into the event.

So the first one finds a tab and changes its border and background colour
The second sets the url of the active window to a specified value.

Author

Commented:
Thanks! I really need to understand and need to break down further details of it and am confident you can be of tremendous help and thanks more on your patience in advance.
In the example I showed you $respTabs is the  control is?
Most Valuable Expert 2017
Distinguished Expert 2018

Commented:
I am not sure of what you are asking?

Author

Commented:
I'm not sure what's $RespTabs is if it is the control object.
Most Valuable Expert 2017
Distinguished Expert 2018

Commented:
You have only provided a small bit of code - in order to answer that question we would need to see where it is defined.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial