Search code examples
jqueryjquery-uimodal-dialogjquery-effects

jqueryui modal dialog effects


How can i apply effects to the modal window which contain login form. I want to apply shake effect for the dialog when use submitted the wrong details. This code is failed

$("#dialog-form").effect("shake", { times:5 }, 100);

This is applying the effect to only form not for modal dialog. Is there any way to apply the effect?


Solution

  • You have to apply the effect to the dialog widget itself. You can write:

    $("#dialog-form").dialog("widget").effect("shake", { times: 5 }, 100);
    

    In passing, note that shaking the dialog box in response to invalid input might not be understood by some of your users. I'd suggest you use a clear, understandable validation message instead.