I am trying to change the jQuery-ui dialog overlay image with a button click from inside the dialog, but in the code below the overlay image does not change. I need to edit the CSS of the overlay dynamically in the click event.
$("document").ready(function(){
var divCustom = '<div id="myOverlay">
<div id="button1">button1</div>
<div id="button2">button2</div>
</div>';
$(divCustom).dialog({ height: 400, width: 700, modal: true });
$("#button1").click(function(){
$("#myOverlay .ui-widget-overlay").css({
"background-image": "happy.gif"
});
});
$("#button2").click(function(){
$("#myOverlay .ui-widget-overlay").css({
"background-image": "sad.gif"
});
});
});
Cannot test this without JSFiddle but probably the following should help: