Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7169701
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T15:03:44+00:00 2026-05-28T15:03:44+00:00

I have the following HTML code for dialog box: <div id=modal-dialog class=no-display> <div class=form>

  • 0

I have the following HTML code for dialog box:

<div id="modal-dialog" class="no-display">
        <div class="form">
            <div class="close">

            </div>
            <div align="center">
                <h2><u>form</u></h2>
            </div>          
            <form>
                <label for="yourname">Full name:</label><input type="text" name="yourname">
                <label for="email">E-mail:</label><input type="text" name="email">
                <label for="message">Message:</label></textarea><textarea type="text" name="message"></textarea><br/>
                <div class="clear"></div>
                <p align="center"><button>Send feedback</button></p>
            </form>
        </div>
    </div>

The javascript :

$("#clickfeed").live("click", function() {
        $("#modal-dialog").removeClass("no-display");
    });

I wrote:

$("#modal-dialog").live("keyup", function(e) {
        if(e.keyCode === 27 && !($(this).hasClass("no-display")))
        {
            $("#feedback-modal-dialog input").each(function() {
                $(this).attr("value","");
            });
            $("#feedback-modal-dialog textarea").each(function() {
                $(this).val("");
            });
            $("#modal-dialog").addClass("no-display"); //or .hide()
        }       
    });

The ESC key works only if an input is focused otherwise not.

I want to close modal-dialog box when pressed ESC.

Is a mistake in my JS code ?

Thank you

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T15:03:45+00:00Added an answer on May 28, 2026 at 3:03 pm

    How about this:

    $("html").live("keyup", function(e) {
    
    if(e.keyCode === 27 && !($('#modal-dialog').hasClass("no-display")))
    
        escape_check();
    
    }
    
    }
    
    function escape_check() {
    
    $("#modal-dialog").removeClass("no-display");
    
    $("#feedback-modal-dialog input").each(function() {
        $('#modal-dialog').attr("value","");
    });
    $("#feedback-modal-dialog textarea").each(function() {
        $('#modal-dialog').val("");
    });
    $("#modal-dialog").addClass("no-display"); //or .hide()
    
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following html code: <div id=result1 class=result> ... some html ... ...
I have the following html code: <div class=trial1> He said all but the three
Issue: not able to close modal dialog I have the following code, it works
I have an HTML form: <div id=dialog class=event-dialog title=Create Event> <div id=dialog-inner> <table> <tr><td
I have the following code which builds a JQueryUI Dialog popup. $j('<div></div>') .html(message) .dialog({
I have the following html code. <html> <body> <div style=max-width:1600px; min-width:900px; > <table> </table>
I have the following html code (in the given order) <div id=content>...</div> <div id=footer>...</div>
I have the following HTML code based on a tab menu format, i.e: <div
I have the following html code: <table> <tr> <td> <div id=fixmywidth style=position:relative; height:30px;> <div
Supposed I have the following code: <html:link onclick=jQuery('#add').data('name','${name}').dialog('open'); href=#> And with this, if ${name}

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.