Dominique
Dominique

Reputation: 908

JQuery UI button with hover/background

I got a JQuery UI button with an icon (locked) and I want it to switch to unlocked when I hover, I am pretty sure it's quite simple but after searching on Google I've found no doc/example about that. Here is my code

$("#frmClients button.btnConnexion").button({ icons: { primary: 'ui-icon-locked' }, text: true });

And here the documentation page of the UI http://jqueryui.com/demos/button

Upvotes: 1

Views: 1993

Answers (1)

jmar777
jmar777

Reputation: 39689

This is just a stab, but from the documentation, something like this might work:

$("#frmClients button.btnConnexion")
  .button({ icons: { primary: 'ui-icon-locked' }, text: true })
  .hover(function() {
    $(this).button('option' , 'icons' , { primary: 'ui-icon-unlocked' });
  }, function() {
    $(this).button('option' , 'icons' , { primary: 'ui-icon-locked' });
  });

Upvotes: 3

Related Questions