I am using the following code in html:
Text 1: <input class="form-control text-right" name="majorhead" id="text1" required="" type="number" />
<div class="result_area"></div>
<button class="my_button" type="button" role="button">Click Me</button>
My JS:
<script>
jQuery(".my_button").click(function () {
jQuery.get(ajaxurl, {'action': 'sayhello'},
function (msg) {
jQuery(".result_area").html(msg);
});
});
</script>
For now I am able to achieve my result when I click the button. But I want to achieve the same result while typing(my code will need to check for every keys typed) in the input text.