I have an input text field:
<input type="text" id="from_input" class="form-control" placeholder="FROM">
I want to get the value of text when it changes. Here is my jquery code:
<script>
var fromValue;
$(document).ready(function(){
$("#from_input").change(function() {
fromValue = $(this).val();
});
console.log(fromValue);
});
</script>
I am getting fromValue variable as undefined. I need to get the text field value for further calculation in whole script. How can I achieve this?