R
R
Robot2015-11-13 21:50:11
JavaScript
Robot, 2015-11-13 21:50:11

How to display an object in a DIV?

As soon as the data in input changes, displaying it in alert works:

<input id="foo"... >
<script type="text/javascript">
  $('#foo').change(function(){
  var ff = $('#foo').val();
    alert('Элемент foo был изменен' + ff);
  });
</script>


Now I want to display the data from the form in a DIV id=forecast
<input id="foo"... >
<script type="text/javascript">
  $('#foo').change(function(){
  var ff = $('#foo').val();
    $('#forecast').load(ff);
  });
</script>
<div id="forecast"></div>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Semenko, 2015-11-13
@iam_not_a_robot

<input id="foo"... >
<script type="text/javascript">
  $('#foo').change(function() {
  var foo = $(this).val();
    $('#forecast').text(foo);
  });
</script>
<div id="forecast"></div>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question