Welcome To Snipplr


Everyone's Recent JavaScript Snippets



1 ... 4 5 6 7 8 ... 65
A simple template for a JavaScript function which allows for an arbitrary number of named arguments to be passed in. This is achieved by passing a single object as an argument with each of the 'real' arguments being a key/value pair. In this way argu...
0 1124 posted 11 years ago by davidwaterston
Logs offline application cache states. Swaps cache if updated version is available.
0 528 posted 11 years ago by zfisic
Basic information on JavaScript from CodeAcademy.com's JavaScript track
0 618 posted 11 years ago by denakitan
Clear text input when the user selects it (on focus)
0 691 posted 11 years ago by rickygri
JavaScript is the only option, if you want to have the ability to clear all form fields. Yes, HTML form has Reset method, but if the form has initial values, then Reset will return the form to the initial state instead of clear input fields. This exa...
1 751 posted 11 years ago by laxman2021
For those moments of weakness when .replace() looks like a good idea...
0 796 posted 11 years ago by inreflection7
Ask the user with a confirmation dialog if the link should be followed or not.
0 547 posted 11 years ago by gummiost
The marquee will stop when you hover the cursor over it. It will restart when you move the cursor away from it.
1 715 posted 11 years ago by o0110o
generischer Handler für die Eventausgabe in der Konsole....
0 748 posted 11 years ago by dejot
jsHint happy class template for javascript
1 768 posted 11 years ago by XtreamIT
**Simple JavaScript Quiz** Edit the main quiz array with your own questions, then publish. Since it's an entire HTML file, it's best to save this file on a server and embed it as needed using an iframe tag.
0 2338 posted 11 years ago by jrue
Set the desired date within the function. Make some images and label them "1.jpg, 2.jpg, 3.jpg, etc...". That's how it's done.
1 721 posted 11 years ago by o0110o
javascript arrays up and down
2 597 posted 11 years ago by kutyadog
Any valid json object will be recursively traversed building a nested unordered list of its properties and their values. This example parses the json entered in the text area into an object that is passed to the json_tree() function. I use the twit...
0 897 posted 11 years ago by halk
Emulates the StringBuilder() function found in .NET Languages
0 476 posted 11 years ago by jswaringen
this is how to instantiate a dropdown shadow using js code, works in IE10 and windows store apps. Important for when you want use templates.
0 1046 posted 11 years ago by Syllogism
Para limpiar o borrar una parte especifica de nuestro canvas podemos usar la función clearRect()
0 1193 posted 11 years ago by maiden
Allows you to click a given checkbox X, then shift click another checkbox Y. All checkboxes between X and Y will be checked or unchecked based on the state of checkbox Y. i.e. if you're unchecking Y all boxes between X and Y will also be unchecked.
1 1072 posted 11 years ago by ReedD19
Obtener el último video favorito de un usuario de youtube
0 477 posted 11 years ago by alexdw
Simple code example that allows you to pull a time stamp / timestamp to attach to end of URL for GET POST calls
0 866 posted 11 years ago by kutyadog
Code from https://snipt.net/geekyjohn/get-url-param/ updated so that most jslint issues are resolved, and updated the return to use a guard condition instead of a separate if statement.
1 1014 posted 11 years ago by pmw57
Standard hasClass, addClass, and removeClass functions. - reworked so that jsLint is happy about them - removeClass function trims things after removing a class name - tests help to ensure that all common use-cases are covered
2 1051 posted 11 years ago by pmw57
Simulate the $_GET array from php in javascript to get url parameters this way: url= http://localhost/?var1=example $_GET['var1'] will return "example" Just copy and paste the code.
2 911 posted 11 years ago by sergiazow
Javascript Basic Date Formatter
0 1506 posted 11 years ago by samsonl
Comprueba la existencia de una cadena de texto en un input con javascript. (LA impresion del input está en CAKEPHP)
0 572 posted 11 years ago by serialk89
Simply changes the name attribute on input elements when the page is loaded.
0 616 posted 11 years ago by stevielamb83
Original by dvdrtrgn
0 829 posted 11 years ago by guilhermehn
How does it work? This code checks/unchecks all checkboxes within the same fieldset. Simple and semantic. HTML Setup Add checkboxes however you like, just make sure they are within the same fieldset. <fieldset> <!--> <div><input>...
1 581 posted 11 years ago by dnnsldr
Here’s a handy bit of code that I use quite regularly, its particularly useful if your getting a response message from a form to notify the user that there data was sent, or comunicate an error and you want to fade the message out after a set time.
1 787 posted 11 years ago by dnnsldr
//You cannot change the whole url without redirecting, what you can do instead is change the hash. //The hash is the part of the url that goes after the # symbol. //That was initially intended to direct you (locally) to sections of your HTML doc...
0 714 posted 11 years ago by dnnsldr
1 ... 4 5 6 7 8 ... 65