Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

removing the focus of an select

MY question may be stupid but I want to know if there is a chance to change this behaviour.

I've noticed that when you click on the arrow of select tag to open the options of the dropdown and when you point at one option, it's highlighted in blue color background and that's OK.

But in IE when you click on the option you want to select and it becomes the selected option the blue highlighting remains until you click somewhere else outside the select tag (it's not that way in firefox - ). BUt i understood whAT I should do and removed the focus from the element when an option has been selected.

$('select').change(function() {
    $(this).blur();
})

But still one little problem stays - if the option that is selected is the same as the previous (for example I choose one element two times consecutively)the focus stays on select and the blue highlighting is on again. Is there any way to change that

like image 875
Tania Marinova Avatar asked Feb 28 '13 19:02

Tania Marinova


2 Answers

In IE11 (not sure about previous versions) you can remove the blue background from a focused select element with

select::-ms-value {background: none;}

Here's a dabblet demo

like image 200
willrice Avatar answered Sep 30 '22 18:09

willrice


Try this in the css:

input:focus,
select:focus,
textarea:focus,
button:focus {
    outline: none;
}

I think that's what you are looking for.

like image 37
BingeBoy Avatar answered Sep 30 '22 19:09

BingeBoy