Skip to content

Tag: jquery

Javascript event that runs before page changes

Is there such a thing? I know that I can hook my function on the click event of all links, but there are other situations where a page is changed, like refresh or when a different script changes the window.location In the end, I did it by sending a string trough postMessage from the unload event, like this: i…

How to detect radio button deselect event?

Is there an easy way to attach a “deselect” event on a radio button? It seems that the change event only fires when the button is selected. HTML JavaScript jsFiddle ​ Answer Why don’t you simply create a custom event like, lets say, deselect and let it trigger on all the members of the click…

Fast way to get the min/max values among properties of object

I have an object in javascript like this: Is there a fast way to get the minimum and maximum value among the properties without having to loop through them all? because the object I have is huge and I need to get the min/max value every two seconds. (The values of the object keeps changing). Answer There&#821…

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 ho…

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, …