Skip to content
Advertisement

How to access the parentNode of a selection to raise an element?

I’ve created the following document: When I mouse over each path I want to append it last inside the svg:g so it appears on top of the other lines, but I don’t know how to properly select the parentNode: p1 works, but I wanted to make sure that this is a .line, so I preferred to use current_gene_pcp, but p2

How to add listener for a custom event in the DOM?

What I want is to create my own function that will be bound as an event listener similar to how other event listeners (e.g., onclick) are set: Is it possible and if so how? Answer The problem you have is the browser does not realize it is a function in there. It is a string, the only way you can

How to define setter/getter on prototype

EDIT Oct 2016: Please note this question was asked in 2012. Every month or so someone adds a new answer or comment that refutes an answer, but doesn’t really make sense to do so as the question is probably out of date (remember, it was for Gnome Javascript to write gnome-shell extensions, not browser stuff, which is quite specific). Following

how to get youtube video id from url

I am trying to check whether a url is a valid youtube video URL and get the youtube video ID from it, so far I am using a simple javascript split function in order to achieve this, however this has some minor disadvantages as youtube has multiple URL’s. I have been viewing other stackoverflow threads however all of them only

Sending websocket ping/pong frame from browser

I keep reading about ping/pong messages in websockets to keep the connection alive, but I’m not sure what they are. Is it a distinct frame type? (I don’t see any methods on a javascript WebSocket object in chrome related to ping-pong). Or is it just a design pattern (e.g. I literally send “ping” or any other string to the server

setInterval(function(),time) change time on runtime

I want to change setInterval function time when my code is running. I try this First SetInterval does not work! Answer You’re clearing the interval on the next line, so the first one wont work, as it gets cleared right away : Also, as gdoron says, setting a interval of nothing isn’t really valid, and not a really good idea

Advertisement