javascript - jquery text change event is not fired in chrome -
i tried put jquery change
event inside document.ready
no luck. change
event working in firefox , ie, not in chrome. alert box not appearing while changing values in ctl00_contentplaceholder1_txt_regno
textbox.
but when type in textbox , remove value using backspace textbox it's working in chrome. should work @ first time while changing values in textbox in chrome.
script:
$("#ctl00_contentplaceholder1_txt_regno").change(function () { alert("done"); var regno = $("#<%= txt_regno.clientid %>").val(); var fleetno = $("#<%= txt_fleetno.clientid %>"); var customername = $("#<%= txtcustomername.clientid %>"); var ridername = $("#<%= txtridername.clientid %>"); var phoneno = $("#<%= txtphoneno.clientid %>"); var email = $("#<%= txtemail.clientid %>"); var chassis = $("#<%= txtchassis.clientid %>"); var ddlmodel = $("#<%= ddl_model.clientid %>"); var ddltype = $("#<%= ddl_type.clientid %>"); var ddlcolor = $("#<%= ddl_color.clientid %>"); var ddl_year = $("#<%= ddlyear.clientid %>"); var kms = $("#<%= txtkmsrun.clientid %>"); var ddladvisor = $("#<%= ddl_serviceadvisor.clientid %>"); var expirydate = $("#<%= txtexpirydate.clientid %>"); var notes = $("#<%= txtnotes.clientid %>"); var data = { regno: regno }; var jsondata = json.stringify(data); $.ajax({ type: "post", url: "jobcard.aspx/populate_reg", data: jsondata, contenttype: "application/json; charset=utf-8", datatype: "json", success: function (data) { if (data.d.length > 0) { var e; (var = 0; < data.d.length; i++) { fleetno.val(data.d[i].fleetno); customername.val(data.d[i].customer_name); ridername.val(data.d[i].ridername); phoneno.val(data.d[i].phoneno); email.val(data.d[i].email); chassis.val(data.d[i].chassisno); ddlmodel.val(data.d[i].make); ddltype.val(data.d[i].model); ddlcolor.val(data.d[i].color); ddl_year.val(data.d[i].year); kms.val(data.d[i].kmsrun); ddladvisor.val(data.d[i].advisorid); expirydate.val(data.d[i].expirydate); notes.val(data.d[i].notes); e = expirydate.val() } var d1 = date.parse(e); var dt = new date(d1); var dateexpiry = dt.getmonth() + 1 + "/" + dt.getdate() + "/" + dt.getfullyear(); var d = new date; var datenow = d.getmonth() + 1 + "/" + d.getdate() + "/" + d.getfullyear(); if (dateexpiry <= datenow) { checkregno() } } }) }); });
instead change , keypress event used focusout event of jquery , it`s working fine according requirement
$("#ctl00_contentplaceholder1_txt_regno").focusout(function () { //your method body )};
Comments
Post a Comment