On Submit to display span value into textfield - Javascript jQuery

Javascript examples for jQuery:Text

Description

On Submit to display span value into textfield

Demo Code

ResultView the demo in separate window

<html>
 <head> 
  <meta name="viewport" content="width=device-width, initial-scale=1"> 
  <script type="text/javascript" src="https://code.jquery.com/jquery-2.1.0.js"></script> 
  <script type="text/javascript">
    $(function(){/* w ww  .  j ava  2  s.  c  o m*/
$('#submit').on('click', function(){
$('#result').val($('#count').html());
});
    });

      </script> 
 </head> 
 <body> 
  <span id="count">4</span> 
  <input type="text" id="result"> 
  <input type="button" id="submit">  
 </body>
</html>

Related Tutorials