2

This is an example what i need to do.

jQuery:

<script>
   $(document).ready(function(){
      var inputvalue = "field 1";
   });
</script>

HTML:

<html>
<body>
<div><input value="<!-- inputvalue here -->"></div>
</body>
</html>
azhanz
  • 55
  • 1
  • 1
  • 5
  • 2
    `$('input').val(inputvalue);` – Ram Sep 08 '13 at 10:15
  • 1
    the comment above will work for your specific case since you have only 1 input in your html. You should use ids for your input, in case you have multiple ones $('#SomeInput').val(inputvalue); – Kharaone Sep 08 '13 at 10:19

1 Answers1

3
<script>
   $(document).ready(function(){
      var inputvalue = "field 1";
      $('#id1').val(inputvalue);
   });
</script>

<html>
<body>
<div><input id="id1" value=""></div>
</body>
</html>
Biswajit Maji
  • 869
  • 13
  • 23