Q:

Is there any possibility to work with all elements of the same class except 'this' in JS and jQuery

When I use this for various elements of same class, is there any possibility in JS/ jQuery to work with something like all elements except that one selected in order to write less code?
$('.field').focus(function() {
  $(this).css('border-bottom','3px solid red');
 $(all other elements of the class .field). $(this).css('border-bottom','3px solid grey');
});

A:

You can use .not(this)
var fields = $('.field').focus(function() {
  fields
    .css('border-bottom','3px solid grey')
    .not(this).css('border-bottom','3px solid red');
});

Added a simple example using .not below to illustrate how it works. Hope this helps

var fields = $('.field').on('click', function() {
  fields
   .css('border','3px solid grey')
   .not(this).css('border','3px solid red');
});
.selected {
  color: red;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="field">One</div>
<div class="field">Two</div>
<div class="field">Three</div>
<div class="field">Four</div>
<div class="field">Five</div>

For this specific scenario, you can also do something like this without .not()
var fields = $('.field').focus(function() {
  fields.css('border-bottom','3px solid grey');
  $(this).css('border-bottom','3px solid red');
});

