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
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
Share Improve this question edited Feb 28, 2013 at 19:28 Aaron Kurtzhals 2,0363 gold badges17 silver badges22 bronze badges asked Feb 28, 2013 at 19:23 Tania MarinovaTania Marinova 1,8988 gold badges42 silver badges67 bronze badges 5 |3 Answers
Reset to default 6In 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
Try this in the css:
input:focus,
select:focus,
textarea:focus,
button:focus {
outline: none;
}
I think that's what you are looking for.
You can set the selected dropdowns background colour in css with:
select:focus {
background: #fff;
}
As for removing the focus of the element I you are going to create more problems than you resolve and I would reconsider if it's necessary.
select{outline:none;}
? – Vucko Commented Feb 28, 2013 at 19:26