How to make a button change color when clicked and then change back to its original color when a different button is clicked?How to change an input button image using CSS?Opacity CSS not working in IE8Transitions on the display: propertyHow to make Twitter Bootstrap menu dropdown on hover rather than clickCSS background image to fit width, height should auto-scale in proportionPassing data to a bootstrap modalHow to change background -color when toggle button clicked?Changing color for different elementsChange tab color when button clickedchange background color on button click
How to draw twisted cuves?
PI 4 screen rotation from the terminal
Applied Meditation
Being told my "network" isn't PCI Complaint. I don't even have a server! Do I have to comply?
Does the problem of P vs NP come under the category of Operational Research?
Does KNN have a loss function?
What's the term for a group of people who enjoy literary works?
Who's behind community AMIs on Amazon EC2?
"Fewer errors means better products" or "Fewer errors mean better products"?
Map vs. Table for index-specific operations on 2D arrays
Reasons for using monsters as bioweapons
What is the reason behind water not falling from a bucket at the top of loop?
Need help in optimizing the below helper class
Can the additional attack from a Samurai fighter's Rapid Strike feature be made at advantage?
What is realistic quality of computer blueprints quickly backed up before apocalypse and their impact on future design?
Why have both: BJT and FET transistors on IC output?
Is this popular optical illusion made of a grey-scale image with coloured lines?
Python π = 1 + (1/2) + (1/3) + (1/4) - (1/5) + (1/6) + (1/7) + (1/8) + (1/9) - (1/10) ...1748 Euler
Basic transistor circuit
UX writing: When to use "we"?
Accurately recalling the key - can everyone do it?
How to trick a fairly simplistic kill-counter?
Can it be useful for a player block with a hanging piece in a back rank mate situation?
Were there any unmanned expeditions to the moon that returned to Earth prior to Apollo?
How to make a button change color when clicked and then change back to its original color when a different button is clicked?
How to change an input button image using CSS?Opacity CSS not working in IE8Transitions on the display: propertyHow to make Twitter Bootstrap menu dropdown on hover rather than clickCSS background image to fit width, height should auto-scale in proportionPassing data to a bootstrap modalHow to change background -color when toggle button clicked?Changing color for different elementsChange tab color when button clickedchange background color on button click
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I have two buttons and I want the background-color to change color when I click one of them and then change back to its original color when I click the other button. I also want a hover feature that shows the color the button would be if it were to be clicked with some opacity.
I've tried
button:hover
background-color: pink;
opacity: .5;
button:focus
background-color: pink;
This works fine until I click anywhere in the screen and the color change is gone.
I've also tried
var buttons = $('button');
buttons.click(function()
buttons.css('background-color', 'snow');
$(this).css('background-color', 'pink');
);
This also works fine except the hover effect stops working like I want it to. When I hover over a button, you can see the opacity change but it is no longer pink.
Is there a way to adjust either of these attempts to make it work properly? Thanks in advance
javascript jquery html css
add a comment |
I have two buttons and I want the background-color to change color when I click one of them and then change back to its original color when I click the other button. I also want a hover feature that shows the color the button would be if it were to be clicked with some opacity.
I've tried
button:hover
background-color: pink;
opacity: .5;
button:focus
background-color: pink;
This works fine until I click anywhere in the screen and the color change is gone.
I've also tried
var buttons = $('button');
buttons.click(function()
buttons.css('background-color', 'snow');
$(this).css('background-color', 'pink');
);
This also works fine except the hover effect stops working like I want it to. When I hover over a button, you can see the opacity change but it is no longer pink.
Is there a way to adjust either of these attempts to make it work properly? Thanks in advance
javascript jquery html css
use class to change colors, addClass and removeClass toggle.
– Grzegorz Miśkiewicz
Mar 27 at 0:23
I would just recommend using the focus pseudo selector
– Kognise
Mar 27 at 0:26
add a comment |
I have two buttons and I want the background-color to change color when I click one of them and then change back to its original color when I click the other button. I also want a hover feature that shows the color the button would be if it were to be clicked with some opacity.
I've tried
button:hover
background-color: pink;
opacity: .5;
button:focus
background-color: pink;
This works fine until I click anywhere in the screen and the color change is gone.
I've also tried
var buttons = $('button');
buttons.click(function()
buttons.css('background-color', 'snow');
$(this).css('background-color', 'pink');
);
This also works fine except the hover effect stops working like I want it to. When I hover over a button, you can see the opacity change but it is no longer pink.
Is there a way to adjust either of these attempts to make it work properly? Thanks in advance
javascript jquery html css
I have two buttons and I want the background-color to change color when I click one of them and then change back to its original color when I click the other button. I also want a hover feature that shows the color the button would be if it were to be clicked with some opacity.
I've tried
button:hover
background-color: pink;
opacity: .5;
button:focus
background-color: pink;
This works fine until I click anywhere in the screen and the color change is gone.
I've also tried
var buttons = $('button');
buttons.click(function()
buttons.css('background-color', 'snow');
$(this).css('background-color', 'pink');
);
This also works fine except the hover effect stops working like I want it to. When I hover over a button, you can see the opacity change but it is no longer pink.
Is there a way to adjust either of these attempts to make it work properly? Thanks in advance
javascript jquery html css
javascript jquery html css
edited Mar 27 at 15:27
Mister Jojo
2,3792 gold badges2 silver badges19 bronze badges
2,3792 gold badges2 silver badges19 bronze badges
asked Mar 27 at 0:19
idkhow2codeidkhow2code
82 bronze badges
82 bronze badges
use class to change colors, addClass and removeClass toggle.
– Grzegorz Miśkiewicz
Mar 27 at 0:23
I would just recommend using the focus pseudo selector
– Kognise
Mar 27 at 0:26
add a comment |
use class to change colors, addClass and removeClass toggle.
– Grzegorz Miśkiewicz
Mar 27 at 0:23
I would just recommend using the focus pseudo selector
– Kognise
Mar 27 at 0:26
use class to change colors, addClass and removeClass toggle.
– Grzegorz Miśkiewicz
Mar 27 at 0:23
use class to change colors, addClass and removeClass toggle.
– Grzegorz Miśkiewicz
Mar 27 at 0:23
I would just recommend using the focus pseudo selector
– Kognise
Mar 27 at 0:26
I would just recommend using the focus pseudo selector
– Kognise
Mar 27 at 0:26
add a comment |
2 Answers
2
active
oldest
votes
The problem is that your code is overriding the background-color
property. Add the !important
to your .button:hover
and it will work as you expect. Snippet below:
var buttons = $('button');
buttons.click(function()
buttons.css('background-color', 'snow');
$(this).css('background-color', 'pink');
);
button:hover
background-color: pink !important;
opacity: .5;
button:focus
background-color: pink;
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<button>First</button>
<button>Second</button>
<button>Third</button>
This is not the best way to solve this. Just reorder the selectors lmao.
– Kognise
Mar 27 at 0:29
@Kognise, can't figure out why. Reorder the selectors didn't solve the problem
– mthrsj
Mar 27 at 0:32
add a comment |
As i said use Radio Buttons...
[edit]
with 2 version to get value event JS or jQuery
/* jQuery */
$('input[name="btGrp"]').on('change', function()
console.clear();
console.log ('button is ', $(this).val());
// do button stuff...
);
/* */
/* pure JS * /
document.querySelectorAll('input[name="btGrp"]').forEach(xRadio=>xRadio.onchange=evt=>
console.clear();
console.log( 'button is ', evt.target.value);
// do button stuff...
);
/* */
input[type="radio"] display: none
input[type="radio"]+label
display : inline-block;
background-color : snow;
border : 3px solid #7986cb;
border-radius : 6px;
color : #37474f;;
width : 160px;
padding : 5px 0;
text-align : center;
margin : 5px;
input[type="radio"]+label:hover background-color: lightblue;
input[type="radio"]:checked + label background-color: pink;
input[type="radio"]:checked + label:hover background-color: lightgreen
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<input id="bt-1" type="radio" name="btGrp" value="b1" >
<label for="bt-1">button 1 </label>
<input id="bt-2" type="radio" name="btGrp" value="b2" >
<label for="bt-2">button 2 </label>
<input id="bt-3" type="radio" name="btGrp" value="b3" >
<label for="bt-3">button 3 </label>
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55368027%2fhow-to-make-a-button-change-color-when-clicked-and-then-change-back-to-its-origi%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
The problem is that your code is overriding the background-color
property. Add the !important
to your .button:hover
and it will work as you expect. Snippet below:
var buttons = $('button');
buttons.click(function()
buttons.css('background-color', 'snow');
$(this).css('background-color', 'pink');
);
button:hover
background-color: pink !important;
opacity: .5;
button:focus
background-color: pink;
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<button>First</button>
<button>Second</button>
<button>Third</button>
This is not the best way to solve this. Just reorder the selectors lmao.
– Kognise
Mar 27 at 0:29
@Kognise, can't figure out why. Reorder the selectors didn't solve the problem
– mthrsj
Mar 27 at 0:32
add a comment |
The problem is that your code is overriding the background-color
property. Add the !important
to your .button:hover
and it will work as you expect. Snippet below:
var buttons = $('button');
buttons.click(function()
buttons.css('background-color', 'snow');
$(this).css('background-color', 'pink');
);
button:hover
background-color: pink !important;
opacity: .5;
button:focus
background-color: pink;
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<button>First</button>
<button>Second</button>
<button>Third</button>
This is not the best way to solve this. Just reorder the selectors lmao.
– Kognise
Mar 27 at 0:29
@Kognise, can't figure out why. Reorder the selectors didn't solve the problem
– mthrsj
Mar 27 at 0:32
add a comment |
The problem is that your code is overriding the background-color
property. Add the !important
to your .button:hover
and it will work as you expect. Snippet below:
var buttons = $('button');
buttons.click(function()
buttons.css('background-color', 'snow');
$(this).css('background-color', 'pink');
);
button:hover
background-color: pink !important;
opacity: .5;
button:focus
background-color: pink;
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<button>First</button>
<button>Second</button>
<button>Third</button>
The problem is that your code is overriding the background-color
property. Add the !important
to your .button:hover
and it will work as you expect. Snippet below:
var buttons = $('button');
buttons.click(function()
buttons.css('background-color', 'snow');
$(this).css('background-color', 'pink');
);
button:hover
background-color: pink !important;
opacity: .5;
button:focus
background-color: pink;
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<button>First</button>
<button>Second</button>
<button>Third</button>
var buttons = $('button');
buttons.click(function()
buttons.css('background-color', 'snow');
$(this).css('background-color', 'pink');
);
button:hover
background-color: pink !important;
opacity: .5;
button:focus
background-color: pink;
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<button>First</button>
<button>Second</button>
<button>Third</button>
var buttons = $('button');
buttons.click(function()
buttons.css('background-color', 'snow');
$(this).css('background-color', 'pink');
);
button:hover
background-color: pink !important;
opacity: .5;
button:focus
background-color: pink;
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<button>First</button>
<button>Second</button>
<button>Third</button>
answered Mar 27 at 0:27
mthrsjmthrsj
1,7961 gold badge7 silver badges24 bronze badges
1,7961 gold badge7 silver badges24 bronze badges
This is not the best way to solve this. Just reorder the selectors lmao.
– Kognise
Mar 27 at 0:29
@Kognise, can't figure out why. Reorder the selectors didn't solve the problem
– mthrsj
Mar 27 at 0:32
add a comment |
This is not the best way to solve this. Just reorder the selectors lmao.
– Kognise
Mar 27 at 0:29
@Kognise, can't figure out why. Reorder the selectors didn't solve the problem
– mthrsj
Mar 27 at 0:32
This is not the best way to solve this. Just reorder the selectors lmao.
– Kognise
Mar 27 at 0:29
This is not the best way to solve this. Just reorder the selectors lmao.
– Kognise
Mar 27 at 0:29
@Kognise, can't figure out why. Reorder the selectors didn't solve the problem
– mthrsj
Mar 27 at 0:32
@Kognise, can't figure out why. Reorder the selectors didn't solve the problem
– mthrsj
Mar 27 at 0:32
add a comment |
As i said use Radio Buttons...
[edit]
with 2 version to get value event JS or jQuery
/* jQuery */
$('input[name="btGrp"]').on('change', function()
console.clear();
console.log ('button is ', $(this).val());
// do button stuff...
);
/* */
/* pure JS * /
document.querySelectorAll('input[name="btGrp"]').forEach(xRadio=>xRadio.onchange=evt=>
console.clear();
console.log( 'button is ', evt.target.value);
// do button stuff...
);
/* */
input[type="radio"] display: none
input[type="radio"]+label
display : inline-block;
background-color : snow;
border : 3px solid #7986cb;
border-radius : 6px;
color : #37474f;;
width : 160px;
padding : 5px 0;
text-align : center;
margin : 5px;
input[type="radio"]+label:hover background-color: lightblue;
input[type="radio"]:checked + label background-color: pink;
input[type="radio"]:checked + label:hover background-color: lightgreen
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<input id="bt-1" type="radio" name="btGrp" value="b1" >
<label for="bt-1">button 1 </label>
<input id="bt-2" type="radio" name="btGrp" value="b2" >
<label for="bt-2">button 2 </label>
<input id="bt-3" type="radio" name="btGrp" value="b3" >
<label for="bt-3">button 3 </label>
add a comment |
As i said use Radio Buttons...
[edit]
with 2 version to get value event JS or jQuery
/* jQuery */
$('input[name="btGrp"]').on('change', function()
console.clear();
console.log ('button is ', $(this).val());
// do button stuff...
);
/* */
/* pure JS * /
document.querySelectorAll('input[name="btGrp"]').forEach(xRadio=>xRadio.onchange=evt=>
console.clear();
console.log( 'button is ', evt.target.value);
// do button stuff...
);
/* */
input[type="radio"] display: none
input[type="radio"]+label
display : inline-block;
background-color : snow;
border : 3px solid #7986cb;
border-radius : 6px;
color : #37474f;;
width : 160px;
padding : 5px 0;
text-align : center;
margin : 5px;
input[type="radio"]+label:hover background-color: lightblue;
input[type="radio"]:checked + label background-color: pink;
input[type="radio"]:checked + label:hover background-color: lightgreen
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<input id="bt-1" type="radio" name="btGrp" value="b1" >
<label for="bt-1">button 1 </label>
<input id="bt-2" type="radio" name="btGrp" value="b2" >
<label for="bt-2">button 2 </label>
<input id="bt-3" type="radio" name="btGrp" value="b3" >
<label for="bt-3">button 3 </label>
add a comment |
As i said use Radio Buttons...
[edit]
with 2 version to get value event JS or jQuery
/* jQuery */
$('input[name="btGrp"]').on('change', function()
console.clear();
console.log ('button is ', $(this).val());
// do button stuff...
);
/* */
/* pure JS * /
document.querySelectorAll('input[name="btGrp"]').forEach(xRadio=>xRadio.onchange=evt=>
console.clear();
console.log( 'button is ', evt.target.value);
// do button stuff...
);
/* */
input[type="radio"] display: none
input[type="radio"]+label
display : inline-block;
background-color : snow;
border : 3px solid #7986cb;
border-radius : 6px;
color : #37474f;;
width : 160px;
padding : 5px 0;
text-align : center;
margin : 5px;
input[type="radio"]+label:hover background-color: lightblue;
input[type="radio"]:checked + label background-color: pink;
input[type="radio"]:checked + label:hover background-color: lightgreen
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<input id="bt-1" type="radio" name="btGrp" value="b1" >
<label for="bt-1">button 1 </label>
<input id="bt-2" type="radio" name="btGrp" value="b2" >
<label for="bt-2">button 2 </label>
<input id="bt-3" type="radio" name="btGrp" value="b3" >
<label for="bt-3">button 3 </label>
As i said use Radio Buttons...
[edit]
with 2 version to get value event JS or jQuery
/* jQuery */
$('input[name="btGrp"]').on('change', function()
console.clear();
console.log ('button is ', $(this).val());
// do button stuff...
);
/* */
/* pure JS * /
document.querySelectorAll('input[name="btGrp"]').forEach(xRadio=>xRadio.onchange=evt=>
console.clear();
console.log( 'button is ', evt.target.value);
// do button stuff...
);
/* */
input[type="radio"] display: none
input[type="radio"]+label
display : inline-block;
background-color : snow;
border : 3px solid #7986cb;
border-radius : 6px;
color : #37474f;;
width : 160px;
padding : 5px 0;
text-align : center;
margin : 5px;
input[type="radio"]+label:hover background-color: lightblue;
input[type="radio"]:checked + label background-color: pink;
input[type="radio"]:checked + label:hover background-color: lightgreen
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<input id="bt-1" type="radio" name="btGrp" value="b1" >
<label for="bt-1">button 1 </label>
<input id="bt-2" type="radio" name="btGrp" value="b2" >
<label for="bt-2">button 2 </label>
<input id="bt-3" type="radio" name="btGrp" value="b3" >
<label for="bt-3">button 3 </label>
/* jQuery */
$('input[name="btGrp"]').on('change', function()
console.clear();
console.log ('button is ', $(this).val());
// do button stuff...
);
/* */
/* pure JS * /
document.querySelectorAll('input[name="btGrp"]').forEach(xRadio=>xRadio.onchange=evt=>
console.clear();
console.log( 'button is ', evt.target.value);
// do button stuff...
);
/* */
input[type="radio"] display: none
input[type="radio"]+label
display : inline-block;
background-color : snow;
border : 3px solid #7986cb;
border-radius : 6px;
color : #37474f;;
width : 160px;
padding : 5px 0;
text-align : center;
margin : 5px;
input[type="radio"]+label:hover background-color: lightblue;
input[type="radio"]:checked + label background-color: pink;
input[type="radio"]:checked + label:hover background-color: lightgreen
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<input id="bt-1" type="radio" name="btGrp" value="b1" >
<label for="bt-1">button 1 </label>
<input id="bt-2" type="radio" name="btGrp" value="b2" >
<label for="bt-2">button 2 </label>
<input id="bt-3" type="radio" name="btGrp" value="b3" >
<label for="bt-3">button 3 </label>
/* jQuery */
$('input[name="btGrp"]').on('change', function()
console.clear();
console.log ('button is ', $(this).val());
// do button stuff...
);
/* */
/* pure JS * /
document.querySelectorAll('input[name="btGrp"]').forEach(xRadio=>xRadio.onchange=evt=>
console.clear();
console.log( 'button is ', evt.target.value);
// do button stuff...
);
/* */
input[type="radio"] display: none
input[type="radio"]+label
display : inline-block;
background-color : snow;
border : 3px solid #7986cb;
border-radius : 6px;
color : #37474f;;
width : 160px;
padding : 5px 0;
text-align : center;
margin : 5px;
input[type="radio"]+label:hover background-color: lightblue;
input[type="radio"]:checked + label background-color: pink;
input[type="radio"]:checked + label:hover background-color: lightgreen
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<input id="bt-1" type="radio" name="btGrp" value="b1" >
<label for="bt-1">button 1 </label>
<input id="bt-2" type="radio" name="btGrp" value="b2" >
<label for="bt-2">button 2 </label>
<input id="bt-3" type="radio" name="btGrp" value="b3" >
<label for="bt-3">button 3 </label>
edited Mar 27 at 15:13
answered Mar 27 at 1:05
Mister JojoMister Jojo
2,3792 gold badges2 silver badges19 bronze badges
2,3792 gold badges2 silver badges19 bronze badges
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55368027%2fhow-to-make-a-button-change-color-when-clicked-and-then-change-back-to-its-origi%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
use class to change colors, addClass and removeClass toggle.
– Grzegorz Miśkiewicz
Mar 27 at 0:23
I would just recommend using the focus pseudo selector
– Kognise
Mar 27 at 0:26