Hi,

I'm not able to toggle a ui class in my page.

Basically here is my code:

in the jquery document.ready I subscribe to the event

$("#bBuscar").hover(changeButtonBackColor, normalizeButtonBackColor);

then the other two funtions are like this:

function changeButtonBackColor(evt) 
{
    $("#bBuscar").toggleClass("ui-state-hover ui-corner-all");
}

function normalizeButtonBackColor(evt)
{
    $("#bBuscar").toggleClass("ui-state-hover ui-corner-all");

}

the button starts with the classes:

<asp:Button ID="bBuscar" CssClass="ui-state-default ui-corner-all" runat="server" Text="Buscar"></asp:Button>

and my references in the master page are:

<link type="text/css" rel="stylesheet" href="_scripts/jquery-ui-1.8.14.custom/css/blitzer/jquery-ui-1.8.14.custom.css" />
<script type="text/javascript" src="_scripts/jquery-1.6.1.min.js"></script>
<script type="text/javascript" src="_scripts/jquery-ui-1.8.14.custom/js/jquery-ui-1.8.14.custom.min.js"></script>

When the page loads the button shows the class that it has applied but when I hover or unhover nothing happens.
What am i doing wrong?

Thanks in advance

Recommended Answers

All 2 Replies

I don't think jQuery can find the ID. An asp.net application changes the id's in the actual output. So check using your browser's developer tools. You may need to use a specific class name to get around this.

Hi, i changed the button to a normal button, I did not know I could use normal html buttons to call code-behind code. So I thought I needed to use ASP.NET buttons obligatory, no I changed it to a normal html button and everything works fine.

Thanks

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.