Support » Plugin: Easy Modal » Add a function onto the close button using jquery

  • Hi,
    I want to know how to attach a function onto the close button to empty the contents of the modal on close. I have tried this


    but nothing happens. Any help would be wonderful. I don’t have a live link to my page as it is currently on a dev site.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author danieliser


    Not sure what you are trying to do. Assuming you want to clear inputs so the user can have a blank form?

    If so then try

    If you want to remove the content of that div then just use

    Hope this helps.

    Basically when I launch the modal I have a jquery script that creates form elements in a div. What I want to do is when you click the exit button to close the modal I want to clear all the form inputs.

    Plugin Author danieliser


    Then what you want is to clear the values of the inputs so you need to do something like

    $('input,select').val(''); $('textarea').text('');

    Hope this helps..

    Please take a moment to rate and review the plugin and/or support.

    Still having problems with this issue. I know how to reset my form fields and have done it with a link. I want to however accomplish this same action using the close button of the modal. I have tried using the selector $("a.close-modal") along with the .click() jquery event but nothing happens.

    Plugin Author danieliser


    You will probably need to override the default functionality like so.

    $("#eModal-1 .close-modal").click(function(e){
        // Your code here
Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Add a function onto the close button using jquery’ is closed to new replies.