If you want to display text value in a div to entering some data in a text box, then you need to follow this example code:
<script type="text/javascript"> $('#TextBoxId').on('change',function(){ var TextValue=this.value; $('#YourDivID').text(TextValue); }); </script>
For example:
Create a text box like:
<input type="text" name="my_text" id="my_text">
Define a div on web page. Like:
<div id="myDivID"></div>
Now follow this example:
<script type="text/javascript"> // when enter text in the text box then it work $('#my_text').on('change',function(){ // my_text is text box id, when you put ID then must start with # sign var TextValue=this.value; $('#myDivID').text(TextValue); // myDivID is trhe div ID }); </script>
Question and answer is powered by AnsPress.io