Why Object expected error

Here's my code..
    <script>
        $(document).ready(function () {
            $("#btnSaveEmployeeData").click(function (event, ui) {
                window.location.href = ui.tab;
            });
        });

   
    </script>

Open in new window


Why I'm getting "object expected" error when btnSaveEmployeeData is the button id?
zachvaldezAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

zephyr_hex (Megan)DeveloperCommented:
I suspect that the error is coming from ui.tab.
Try console logging ui to see if it has a tab property.

console.log(ui);

I suspect ui does not have a tab property if btnSaveEmployeeData is a button.  Buttons don't have user interfaces.
0
zachvaldezAuthor Commented:
button is a web control in asp.et
0
zachvaldezAuthor Commented:
Now, why I'm getting error 'Function expected
on this code

       
<script>
          $m("#btnSaveEmployeeData").click('.resp-tabs-container hor_1')(this).addClass('resp-tab-active').css({
            'background-color': options.activetab_bg,
            'border-color': options.active_border_color
        });
    </script>

Open in new window

0
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

zephyr_hex (Megan)DeveloperCommented:
What does console.log(ui) show you?  Use F12 in your browser and inspect the results the console tab.

$(document).ready(function () {
            $("#btnSaveEmployeeData").click(function (event, ui) {
                console.log(ui);
                window.location.href = ui.tab;
            });
        });

Open in new window

0
zachvaldezAuthor Commented:
what should I be looking?
0
zephyr_hex (Megan)DeveloperCommented:
use F12 and look at the console tab in your browser.
1
zachvaldezAuthor Commented:
A simple Jquery won't display the alert message
 <script>
        $m(document).ready(function () {
            $m("#btnSaveEmployeeData").click(function () {
                alert("button");
            });
        });
    </script>

Open in new window

0
zephyr_hex (Megan)DeveloperCommented:
That suggests that you don't have the right Id of the element.  If it's an ASP .NET control, it may be using the ASP .NET id's and not "simple" id's.  Inspect the rendered HTML of your page and see what the element Id shows.

If it's the ASP .NET version of the id, you can bind your event using this:

$('#<%=btnSaveEmployeeData.ClientID%>').click(function () {

Open in new window

0
Julian HansenCommented:
Where have you defined that jQuery is aliased to $m

What does your rendered HTML look like - can you posted that - not ASP code - open page in browser, right click and select view source. Copy the html and paste here.
0
zachvaldezAuthor Commented:
How many Jquery libraries can I add to a project? That is the reason for $m to render no conflict but how true is that?
0
Julian HansenCommented:
You only want 1 jQuery library in your project. You can have as many plugins that rely on jQuery as you need.

The no conflict is not there so you can load multiple jQuery libraries - it is in the event that another library uses the $ and causes a conflict with jQuery - in which case you re-alias jQuery so you can use it in parallel with the conflicting library.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
JavaScript

From novice to tech pro — start learning today.