How can I make this shorter? Maybe as a function?
Hi Guys,
Is there any way in which I can shorten this code?:
- $(document).ready(function(){
- $(".radio__label").focusin(function(){
- $(this).addClass("focus");
- });
- $(".radio__label").focusout(function(){
- $(this).removeClass("focus");
- });
- $(".checkbox__label").focusin(function(){
- $(this).addClass("focus");
- });
- $(".checkbox__label").focusout(function(){
- $(this).removeClass("focus");
- });
- $(".checkbox__label--error").focusin(function(){
- $(this).addClass("focus");
- });
- $(".checkbox__label--error").focusout(function(){
- $(this).removeClass("focus");
- });
- });
Thanks