Omkar Mhaiskar

Omkar Mhaiskar

  • NA
  • 37
  • 12.3k

Select textbox from multiple css class.

Nov 11 2013 9:25 AM
Hi

I am having following  jquery
"<script type="text/javascript">
    $(function () {
        $('input:text:first').focus();
        var $inp = $('.classfirst');
        $inp.bind('keydown', function (e) {
            //var key = (e.keyCode ? e.keyCode : e.charCode);
            var key = e.which;
            if (key == 13) {
                e.preventDefault();
                var nxtIdx = $inp.index(this) + 1;
                $(".classfirst:eq(" + nxtIdx + ")").focus();
            }
        });
    });
    </script>
"

which is used to set focus to next textbox when hit enter button. but it selected only textbox from  classfirst css class i want some modification in the same query which is i want all the textbox from classsecond, classthird, classfourth along with class first.

i am not getting idea how can i achieve this.


please help me to get this result.

Thanks in Advance.

Answers (1)