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?
 
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
 
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
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
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
 
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.