0

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

Edited by pyTony: fixed formatting

2
Contributors
2
Replies
3
Views
6 Years
Discussion Span
Last Post by MrCapuchino
0

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.

0

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

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.