Question:

How can I display entered form data into an alert box?

by  |  earlier

0 LIKES UnLike

I am creating a form, and I would like the data that the user enters to be displayed in an alert box once the user moves the cursor outside of the last text box (an 'onchange' event). I have no idea as to how to pull the data from the form and into an alert box that will display once the user leaves the last text box.

 Tags:

   Report

1 ANSWERS


  1. First I think you will need to use the onblur event not the onchange because onchange happens every time when the value of an input box changes.

    http://www.w3schools.com/jsref/jsref_onb...

    http://www.w3schools.com/jsref/jsref_onc...

    As for the alert box you will need Javascript.

    Something like this:

    function last() {

    alert(document.getElementById("yourinp...

    }

    <input id="yourinputboxid" onblur="last();">

    Or you could use this:

    function last(message) {

    alert(message);

    }

    <input onblur="last(this.value);">

Question Stats

Latest activity: earlier.
This question has 1 answers.

BECOME A GUIDE

Share your knowledge and help people by answering questions.