Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 286517
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T05:38:36+00:00 2026-05-12T05:38:36+00:00

This is what I have On my .master page i have the following <script

  • 0

This is what I have

On my .master page i have the following

<script type="text/javascript">
$(document).ready(function() {
    $(this).hover(function() {
        $(this).addClass("ui-state-hover");
    },
        function() {
            $(this).removeClass("ui-state-hover");
        }
    ).mousedown(function() {
        $(this).addClass("ui-state-active");
    })
    .mouseup(function() {
        $(this).removeClass("ui-state-active");
    });
});

and my asp.net buttons are declared as follows

<asp:button runat="server" id="cmdSubmitShipmentRequest" cssclass="ui-button ui-state-default ui-corner-all" text="Submit" />

The expected behavior is that any time the mouse pointer hovers in and out of any button the above declared css classes are added and removed. Currently the default css properties apply properly but any time I hover in and out of a button I get the following error “Object Expected” Line 11 (IE8 other browsers display nothing), which is the position where the "<script type="text/javascript">" begins.

any clue as to what I may be doing wrong?

EDIT WITH ANSWER



I was doing two things wrong

  1. I was using $(this).hover should of been $(‘.ui-button’).hover which I had initially but I typed it as $(“.ui-button”).hover NOTICE THE DOUBLE QUOTES!

  2. On my .master page I am declaring my javascript using the asp.net javascript manager as follows

the problem was that I had the script declarations below my javascript code block!.

In the end this is what the javascript and code block look like and all works well as expected.

<asp:scriptmanager id="scriptManager" runat="server">
    <scripts>
        <asp:scriptreference path="~/javascript/jquery-1.3.2.min.js" />
        <asp:scriptreference path="~/javascript/jquery-ui-1.7.2.custom.min.js" />
        <asp:scriptreference path="~/Javascript/thickbox.js" />
    </scripts>
</asp:scriptmanager>

 <script type="text/javascript">
     $(document).ready(function() {
         $('.ui-button').hover(function() {
             $(this).addClass("ui-state-hover");
         },
            function() {
                $(this).removeClass("ui-state-hover");
            }
        ).mousedown(function() {
            $(this).addClass("ui-state-active");
        })
        .mouseup(function() {
            $(this).removeClass("ui-state-active");
        });
     });
</script> 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T05:38:37+00:00Added an answer on May 12, 2026 at 5:38 am

    Try changing your code to this….

    $(document).ready(function() {
        //SELECT THE .ui-button CLASS INSTEAD OF this
        $('.ui-button').hover(function() {
            $(this).addClass("ui-state-hover");
        },
                    function() {
                        $(this).removeClass("ui-state-hover");
                    }
            ).mousedown(function() {
                $(this).addClass("ui-state-active");
            })
            .mouseup(function() {
                $(this).removeClass("ui-state-active");
            });
    });
    

    I do not believe that “this” has the context that you were targeting when you use this line of code…

    $(this).hover(function() {
    

    Try replacing the line above with the following…

    $('.ui-button').hover(function() {
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this code, I added JS Script file to my Master page. <script
I have a master page, and this master page has the following code <%@
I have a master page in C#, where I have this code: <div style=width:
I have a master page called SampleMaster.master and this page contains a Repeater control
I have one master page which applies to all pages in this website. On
I have a master page, with a help link in the top menu. This
In a Master page, I have this.... <ul id=productList> <li id=product_a class=active> <a href=>Product
I have 2 master pages that are nested.this is main master page code for
I have an ASP.net master page. In this master, I have all my css
my structure is like this: master page aspx(web form) ascx(user control) I have a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.