php - HTML, CSS - I want to create a button "Preview" which will show user his input -


let's have simple form example:

<form>     enter title here:     <input type="text" name="title" />     gender:     <select name="gender">         <option value="male">m</option>         <option value="female">f</option>     </select>     yourself:     <textarea name="aboutme"></textarea>     click on button see how form submit.     <button>preview</button> </form> 

this simple form example. now, can't figure out next thing: when user clicks on button "preview", want show him how when clicks on submit. guess need additional css, , php??

with js easy. try this:

function formalert() {          alert_string = '';          alert_string = alert_string + document.getelementbyid('title').value;          alert_string = alert_string + ', ';          alert_string = alert_string + document.getelementbyid('gender').value;          alert_string = alert_string + ', ';          alert_string = alert_string + document.getelementbyid('about_me').value;                    alert(alert_string);         }
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>  <form onsubmit="formalert(); return false;" method"post">      enter title here:      <input type="text" name="title" id="title" /><br><br>      gender:      <select name="gender" id="gender">          <option value="male">m</option>          <option value="female">f</option>      </select><br><br>      yourself:<br><br>      <textarea name="aboutme" id="about_me"></textarea><br><br>      click on preview see how form submit.<br><br>      <button>preview</button>      <input type="submit" value="submit"/>  </form>


Comments

Popular posts from this blog

php - How to display all orders for a single product showing the most recent first? Woocommerce -

asp.net - How to correctly use QUERY_STRING in ISAPI rewrite? -

angularjs - How restrict admin panel using in backend laravel and admin panel on angular? -