where disabled is passed in as either true/false. This works fine in IE, it seems to disable in firefox, but the cursor still shows as a hand i.e. the user thinks they'll be able to select the buttons. It should be a normal pointer like IE. Any ideas as to
why this doesn't work the same way as IE and what I can do to fix it in the simplest way possible?
Ok, so I've figured out that it is technically disabling the buttons. But because they're image buttons they don't appear disabled. Still not sure why the hand cursor shows in FF though.
So what's the simplest way of making these buttons look disabled? setting css classes when they're disabled or setting new images? is there a quick way to do this with jquery?
Sorry, like I said I don't have/use FF. But that worked in IE. Maybe FF doesn't support the "cursor" style. Anyway, hopefully someone else can help more.
sophie86
Member
53 Points
336 Posts
Disable image button with jquery
Apr 07, 2010 07:19 PM|LINK
Hi,
I'm trying to disable an image button using jquery as follows:
$("#<%=MyButton.ClientID%>").attr('disabled', disabled);
where disabled is passed in as either true/false. This works fine in IE, it seems to disable in firefox, but the cursor still shows as a hand i.e. the user thinks they'll be able to select the buttons. It should be a normal pointer like IE. Any ideas as to why this doesn't work the same way as IE and what I can do to fix it in the simplest way possible?
sophie86
Member
53 Points
336 Posts
Re: Disable image button with jquery
Apr 07, 2010 07:20 PM|LINK
Ok, so I've figured out that it is technically disabling the buttons. But because they're image buttons they don't appear disabled. Still not sure why the hand cursor shows in FF though.
So what's the simplest way of making these buttons look disabled? setting css classes when they're disabled or setting new images? is there a quick way to do this with jquery?
thanks.
MetalAsp.Net
All-Star
112168 Points
18255 Posts
Moderator
Re: Disable image button with jquery
Apr 07, 2010 07:33 PM|LINK
I think to chaneg the cursor via CSS is reasonable. I don't have FF to test, but try like this:
$("#<%=MyButton.ClientID%>").attr('disabled', 'disabled').css('cursor', 'default'); // use 'pointer' or 'hand' when you enable.
sophie86
Member
53 Points
336 Posts
Re: Disable image button with jquery
Apr 08, 2010 07:38 AM|LINK
This doesn't seem to work :(
This is my function:
function disableMyButton(disabled) {
$("#<%=MyButton.ClientID%>").attr('disabled', disabled);
if (disabled) {
$("#<%=MyButton.ClientID%>").css('cursor', 'pointer');
}
else {
$("#<%=MyButton.ClientID%>").css('cursor', 'hand');
}
}
I still get the hand in FF
Any ideas?
Das.Sandeep
Star
10652 Points
1897 Posts
Re: Disable image button with jquery
Apr 08, 2010 07:49 AM|LINK
Please give us feedback no matter whether you get your answer.
Please "Mark as Answer" if it's useful for you.
Regards,
Sandeep
MetalAsp.Net
All-Star
112168 Points
18255 Posts
Moderator
Re: Disable image button with jquery
Apr 08, 2010 10:09 AM|LINK
Sorry, like I said I don't have/use FF. But that worked in IE. Maybe FF doesn't support the "cursor" style. Anyway, hopefully someone else can help more.