charCodeAt giving wrong charCode

I have this code that checks for right click + pastes in an input, and then passes the char code of each pasted character into a function. However the char code seems incorrect. I have pasted "fds" into an input and it says the charcode of the first character is 102, but the charcode of "f" is 70.

Here is the code:

ko.bindingHandlers.strictNumeric = {
    init: function (element) {
        $(element).bind('input propertychange', function () {
            for (var x = 0; x < $(this).val().length; x++) {
                if (qb.Utils.Number().isAcceptableNonNumericCharacter($(this).val().charCodeAt(x))) {
                } else {

$(this).val() is equal to "fds". The value of the $(this).val().charCodeAt(x) parameter in the first loop is 102 not 70. Why is this?

Answers 1

Related Articles