JQuery replacing form elements with text - Javascript jQuery

Javascript examples for jQuery:Text

Description

JQuery replacing form elements with text

Demo Code

ResultView the demo in separate window

<html>
 <head> 
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> 
  <script>
$(document).ready(function(){
    $("button").click(function(){
        $("div").text($("form").serialize());
    });// w w w . j  a  v a  2s  . co m
});

      </script> 
 </head> 
 <body> 
  <form action="">
    Name: 
   <input type="text" name="name" value="Tina"> 
   <br> Email: 
   <input type="text" name="LastName" value="abc@mail.com"> 
   <br> 
  </form> 
  <button>Export Values</button> 
  <div></div>  
 </body>
</html>

Related Tutorials