Skip to content

Tag: html

Change :hover CSS properties with JavaScript

How can JavaScript change CSS :hover properties? For example: HTML CSS How can the td :hover properties be modified to, say, background:#00ff00, with JavaScript? I know I could access the style background property using JavaScript with: But I don’t know of a .style JavaScript equivalent for :hover. Answ…

javascript enable input on double click

I have a form with some inputs disabled. I want these inputs to be enabled when double clicked. Unfortunately, JS events seem not to fire on disabled inputs. Is there a way around this limitation? Or am I just going to have to wrap any affected input in a span to house the event? http://jsfiddle.net/vhktx/ An…

Why don’t audio and video events bubble?

I was wondering why some Javascript of mine would not work until I figured that the audio events did not bubble up the DOM tree, e.g. the timeupdate-event. Is there a rationale for not letting the events of the audio- and video-tag bubble? Answer The reason why event bubbling exists is solve the ambiguous que…

slideDown jumps abruptly at the end

I’ve built a fairly normal menu-submenu arrangement in a vertical column — nested ULs, using slideToggle to expand and collapse submenus. The problem I’m trying to solve is in the way the submenus “jump” open at the very end. (I’m testing in the latest release of Chrome.) I…

Open link in new window or focus to it if already open

I have a link which should open in a new tab, but if the tab is already open, just switch to it. I’ve tried with javascript, wnd = window.open() and than wnd.focus(), that works in Chrome 19, but not in FF 13 or IE 9. Here’s the code I’ve written : Any idea how can I open or switch to