Oninput event not working when value in text field is passed from another form

85 Views Asked by At

oninput event work absolutely fine whenever I entered mobile number in my small form text field. (as on entering, its show text that number already exist and disable submit button) . But its fails to check existing mobile value and fail to disable submit button When I passed value in text field by value = following code

`<label>Mobile:</label> <input type="text"  name= "mble"  id= "mble" value="<?php echo $mble; ?>" class="form-control" Required maxlength = "12"  oninput="checkAvailability()">`

here is my java script

`<script type="text/javascript">     

function checkAvailability() {
$("#loaderIcon").show();
jQuery.ajax({
url: "proceser.php",
data:'mble='+$("#mble").val(),
type: "POST",
success:function(data){
$("#user-availability-status").html(data);
$("#loaderIcon").hide();
if(data == "<span class=''> Mobile No already exist.</span>") {
$('#submit').prop('disabled', true);
}
else $('#submit').removeAttr('disabled');
},
error:function (){}
});
}
</script>`
1

There are 1 best solutions below

1
On BEST ANSWER

Try triggering the oninput function manually:

$("#mble").trigger("input");