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

  • SEARCH
  • Home
  • 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 561201
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T12:25:29+00:00 2026-05-13T12:25:29+00:00

I have INPUT element and I want to reset the previous value (not necessary

  • 0

I have INPUT element and I want to reset the previous value (not necessary original value). There are 2 ways:

  1. Save the value in another variable and pull it out again
  2. Press ESC key. But I don’t want users to press ESC but click a button.

So for #2, how can I create a ESC keystroke using jquery?

  • 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-13T12:25:29+00:00Added an answer on May 13, 2026 at 12:25 pm

    Here’s an SSCCE:

    <!doctype html>
    <html lang="en">
        <head>
            <title>SO question 2079185</title>
            <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
            <script type="text/javascript">
                $(document).ready(function() {
                    $(':input.remember').each(function() {
                        $(this).attr('data-remember', $(this).val());
                    });
                    $('button.reset').click(function() {
                        $(':input.remember').each(function() {
                            $(this).val($(this).attr('data-remember'));
                        });
                    });
                });
            </script>
        </head>
        <body>
            <input type="text" class="remember" value="foo">
            <button class="reset">Reset</button>
        </body>
    </html>
    

    This basically stores the original value of every input element with a class of remember during onload and instructs the button with a class of reset to restore it whenever clicked.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a input element: <input type=text id=t value=abcdefghij /> I want to create
i have an input element, and i want bind both change and keypress event
I have a file input element that needs to be cloned after the user
I have an input[type=radio] element inside a block container of fixed width. The supporting
I have saved input from a textarea element to a TEXT column in MySQL.
With JavaScript, it is quite easy to have an <input> element automatically take on
I'm trying to set conditions on a jQuery event. I have an input element
I have several input and option elements on my page, each (well almost) have
I have a bunch of input elements that have a particular substring in their
I have two elements: <input a> <input b onclick=...> When b is clicked, I

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.