Skip to content
Advertisement

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: in the

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 clicked radio group except the element

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’s no way to

How to add/subtract dates with JavaScript?

I want to let users easily add and subtract dates using JavaScript in order to browse their entries by date. The dates are in the format: “mm/dd/yyyy”. I want them to be able to click a “Next” button, and if the date is: ” 06/01/2012″ then on clicking next, it should become: “06/02/2012”. If they click the ‘prev’ button then

What is the difference between “window.location.href” and “window.location.hash”?

I learned “window.location.hash” new and tried in my jquery code instead of “window.location.href” and both of them gave same results. Code is here : What is the difference between them? Answer For a URL like http://[www.example.com]:80/search?q=devmo#test hash – returns the part of the URL that follows the # symbol, including the # symbol. You can listen for the hashchange event

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

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