jeudi 25 décembre 2014

keypress,keyup not working in jquery Mobile

I have textFields and Checkboxs.If any text Will be enter in TextField1 automatically Checkbox1 will be checked and If textWill be removed in textField1 automatically Checkbox will be uncheck.I got output in browser.But When i Check in mobile it's not working



$("#LEDList .quantity input").keypress(function(e) {

var qtyId =this.id;
qtyId =qtyId.substr(qtyId.length - 1);
var regex = new RegExp("^[0-9]");
if (this.value.length == 0 && e.which == 48 ){
return false;
}
else{
var str = String.fromCharCode(!e.charCode ? e.which : e.charCode);
if (regex.test(str)) {
$( "#check"+qtyId).prop( "checked", true );
return true;
}


e.preventDefault();
return false;
}
});
$("#LEDList .quantity input").keyup(function(e) {
var qtyId =this.id;
var qtyId1 =qtyId.substr(qtyId.length - 1);

if(($("#"+qtyId).val()).length ==0){

$( "#check"+qtyId1).prop( "checked", false );

}
});
}


I am not understanding.this code this not working in my Mobile so Please tell me .What wrong in my code.Please guide me .





Aucun commentaire:

Enregistrer un commentaire