Page 1 of 1

Why Simple JS Works on JSFiddle, but Not for Me

Posted: Mon Apr 17, 2017 12:43 pm
by diseman
Hi Celauran,

I'm thinking you'll stumble on this and be able to help. This JS is not working on my localhost and wondering why. I've tried Chrome, Opera, and FF. No, I do not have javascript turned off in browsers.

REFERENCE: https://goo.gl/vELiXk
REFERENCE: http://jsfiddle.net/2VETF/3/

What I have:

Code: Select all

<!DOCTYPE HTML>

<html>

<head>

<title>Untitled</title>

<script>

$(function() {
    $(".inputs").keyup(function () {
        if (this.value.length == this.maxLength) {
          $(this).next('.inputs').focus();
        }
    });
});});

</script>

<style type="text/css">
<!--
input { width: 30px; margin: 5px;  }
-->
</style>

</head>

<body>
<input class="inputs" type="text" maxlength="4" />
<input class="inputs" type="text" maxlength="4" />
<input class="inputs" type="text" maxlength="4" />
<input class="inputs" type="text" maxlength="4" />
<input class="inputs" type="text" maxlength="4" />
<input class="inputs" type="text" maxlength="4" />
</body>

</html>

Re: Why Simple JS Works on JSFiddle, but Not for Me

Posted: Mon Apr 17, 2017 1:34 pm
by Celauran
Looks like it depends on jQuery, which I don't see loaded.

Re: Why Simple JS Works on JSFiddle, but Not for Me

Posted: Sat Apr 22, 2017 12:22 pm
by diseman
Hey Celauran,

Sorry for the late reply. I just found your reply in my spam box for some reason.

Ok, thank you for the insight. Gonna go look now and see what's what.

Michael