jeudi 9 avril 2015

jQuery returning character at end of 2nd string rather than 1st


Vote count:

0




I currently have code that reads a barcode scanner, puts that string into a textbox which is then passed through to the URL when the text limit of 8 is passed.


The issue is that the final number of the string, is being placed not on the first string for the textbox, but the second string regarding the barcode. (meaning that instead of davie123, we are getting davie12 and davie1233)



$(document).keydown(function(e) {

var pageURL = "url"

var code = (e.keyCode ? e.keyCode : e.which);

barcode=barcode+String.fromCharCode(code)
if ($('#scanner').val().length = 8 ){
window.location.href = pageURL + "&param=" + $('#scanner').val() +"&barcode=" + barcode+String.fromCharCode(code);
}


});


asked 50 secs ago

Alex

130






jQuery returning character at end of 2nd string rather than 1st

Aucun commentaire:

Enregistrer un commentaire