cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

Quick-add: + add another resource

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

Quick-add: + add another resource

Code Indentation


Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

<html ng-app="tests">
    <meta charset="UTF-8" />
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
    <script src="//cdnjs.cloudflare.com/ajax/libs/angular.js/1.2.16/angular.min.js"></script>
    <h3>Use right and left arrows to move between the fields</h3>
         <div class="contDiv" ng-controller="sampCtrl">
           <form name='sample'>
             <input type="text" ng-model="form.t1" placeholder="text one" form-arrows>
<input type="text" ng-model="form.t2" placeholder="text two" form-arrows>
  <input type="text" ng-model="form.t3" placeholder="text three" form-arrows>
      <input type="text" ng-model="form.t4" placeholder="text four" form-arrows>
        <input type="text" ng-model="form.t5" placeholder="text five" form-arrows>
              angular.module('tests', []);

angular.module('tests').controller('sampCtrl',function($scope) {

angular.module('tests').directive('formArrows', function () {
    return {
        restrict: 'A',
        link: function (scope, element) {
            element.bind("keyup", function(e) {
                // get key code / 39 - Right, 37 - Left, 38 - Up, 40 - Down
                var keyCode = e.keyCode;
                // list page objects to iterate - in this case - :input. Use other selector for similar behavior with different objects
                // use $(':input:enabled') - to rotate just between enabled fields, but just if you have disabled fields
                var inputs = $(':input');
                // caret position
                var cert = element[0].selectionStart;
                // field's content length - used to find right edge of content
                var conLength = element[0].value.length;

                // now just
                    switch (keyCode) {
                        case (39): // Right
                            // if caret position is at the rightmost of the input value
                            if (cert>=conLength) {
                                // get the next element
                                var nextInput = (inputs.index(this) == inputs.length-1) ? inputs.get(0) : inputs.get(inputs.index(this) + 1);
                                if (nextInput) {
                                    //focus on the next element
                                    //move caret to the start of the element
                                    nextInput.selectionStart = 0;
                        case (37):  // Left
                            // if caret position is at the beginning of the input
                            if (cert==0)
                            // get the previous element
                            var prevInput = inputs.get(inputs.index(this) - 1);
                            if (prevInput) {
                                // focus on the previous element

Loading ..................