Is there any way to remove the "hover" selector from an element using code (html, css, or js?) I'm finding that whenever I open my side nav on a mobile site I'm creating, the first element is always "hover" for some reason even though I don't tap it.
Asked
Active
Viewed 249 times
-3
-
1Please edit your answer in order to provide more specific info and code – Roko C. Buljan Feb 23 '14 at 18:43
-
Persnaps: `$(".active).removeClass(".active");` – agconti Feb 23 '14 at 18:44
-
@agconti `jQuery == JS` ... `JS != jQuery` – Roko C. Buljan Feb 23 '14 at 18:45
-
You're talking about ":active" not ".active" right? – aquinas Feb 23 '14 at 18:51
-
@RokoC.Buljan That is for classes. I'm asking about selectors. As aquinas mentions, its :active not .active. – user1795832 Feb 23 '14 at 18:52
-
2This seems like weird behavior. Can you reproduce it in a jsfiddle? Does it only happen on certain devices (iOS or something?). – aquinas Feb 23 '14 at 18:56
-
@aquinas Only on touchscreens. Wondering if when I hit my menu button it thinks I hit the top option in the navigation when it opens as well. Its using the sidr jquery plugin. – user1795832 Feb 23 '14 at 19:01
-
EDIT: It's actually in :hover state. More specifically this is what I see in the dev tools: .sidr ul li:hover>a – user1795832 Feb 23 '14 at 19:38
-
@RokoC.Buljan This is not a duplicate of the question http://stackoverflow.com/questions/2155737/remove-css-class-from-element-with-javascript-no-jquery. That one asks about removing a class from an element, mine is asking about removing a selector from an element. – user1795832 Apr 27 '14 at 15:52
2 Answers
0
Without any code or detailed info it's just a wild guess, but try to add this to your stylesheet:
* {
outline: none;
}
Note: isn't wishful when you care for accessibility.

GreyRoofPigeon
- 17,833
- 4
- 36
- 59
-1
You could simply set the elements class to nothing.
document.getElementById("whatever").className = "";

Bhavik
- 4,836
- 3
- 30
- 45
-
-
if you wanted to keep a particular class you could just reset the class `document.getElementById("whatever").className = ""; document.getElementById("whatever").className = "classToKeep";` – Bhavik Feb 23 '14 at 18:47
-
and next time provide the source of your *idea* http://stackoverflow.com/questions/2155737/remove-css-class-from-element-with-javascript-no-jquery or simply mark the question as duplicate – Roko C. Buljan Feb 23 '14 at 18:47
-
More importantly, he's saying the :active selector, not a class name. As in: "a:active" Or: http://jsfiddle.net/C5bX4/ – aquinas Feb 23 '14 at 18:50