Not strictly legal, but try adding a type="checkbox"
attribute to your div or perhaps do this.button.type = 'checkbox'
The button will still be a div
, but you might get the effect you want.
The other day I was doing some soul searching, tracking down a similar problem, and ended up at the following "offending" lines in jQuery UI:
var self = this,
options = this.options,
toggleButton = this.type === "checkbox" || this.type === "radio",
hoverClass = "ui-state-hover" + ( !toggleButton ? " ui-state-active" : "" ),
focusClass = "ui-state-focus";
A bit after that there is some code that removes the hoverClass
from the button on mouseout
. Essentially you need to force toggleButton
true.
This is 10 out of 10 hackery, though. Use at your own risk.