Welcome To Snipplr
Everyone's Recent JavaScript Snippets Tagged javascript
- All /
- JavaScript /
- HTML /
- PHP /
- CSS /
- Ruby /
- Objective C
This bit of jquery will take whatever you give it in the selector (which should be a valid jquery selector of any kind) and add or remove additional classas as appropriate based on width.
The width and style names are all determined by the last i...
0
884
posted 13 years ago by FatFolderDesigner
Developing a form where I had several date and time fields, I came with a jQuery multiselector where I need to get, through the name attribute, if it was a date or time field. So far, jQuery does not have a boolean method to check if an attribute of...
0
871
posted 13 years ago by betacar
Why do this?
===========
*hopefully* this will cause the page to refresh and provide a stop button in the future. The idea is to use it while developing in a text editor, as in Vim or its ilk, and not have to alt+tab all the _*flipping*_ time.
F...
0
713
posted 13 years ago by inreflection7
found the solution here: http://stackoverflow.com/questions/2790001/fixing-javascript-array-functions-in-internet-explorer-indexof-foreach-etc
0
625
posted 13 years ago by pixelatorz
Pass variables into javascript files using query strings, and return them using getJSvars()
Example
//HTML
<script>
//return the value of "foo"
getJSvars('filename.js', 'foo');
0
877
posted 13 years ago by DenoteIt
This requires my [date formatting script](http://snipplr.com/view/54806/javascript-date-formatting/).
(date).toISO() converts the Date object to an ISO 8601 string
Date.fromISO() converts an ISO 8601 string to a Date object
0
1017
posted 13 years ago by wizard04
Code obtained from a [stackoverflow question](http://stackoverflow.com/questions/4672279/bresenham-algorithm-in-javascript). This is a javascript implementation of the [Bresenham line algorithm](http://en.wikipedia.org/wiki/Bresenham's_line_algorithm...
0
1121
posted 13 years ago by nefd
Restricts the characters that are entered into a textbox. Also limits the length of the value to 5.
0
781
posted 13 years ago by Krummelz
Check if user has intruded a real email address. Return true (real email) or false (fake email).
Arguments: Element from a form.
From book Dom Scripting by Jeremy Keith
0
1134
posted 13 years ago by alberomo
Arguments: Element from a form.
Take that element and checks if is filled. If not, returns false. If is filled, returns true.
From book Dom Scripting by Jeremy Keith
0
1117
posted 13 years ago by alberomo
A JS function that put the focus in the form field associated to a label element whenever is clicked. The for atributte of the label element must match the id attribute of the associated form field.
It takes no arguments.
From book Dom Scripting by...
0
669
posted 13 years ago by alberomo
JS Function that style sibling elements of a given tag. Arguments: tag of the element We want siblings to style and name of the class we want to add. It needs the class to be styled (using CSS). It uses getNextElement function and addClass functions....
0
473
posted 13 years ago by alberomo
A JS function that makes bold the text of table rows ("tr" elements) when you "mouseover" them. It takes no arguments.
From book Dom Scripting by Jeremy Keith.
0
452
posted 13 years ago by alberomo
A JS function that stripes the tables ("table" elements) of a document. It takes no arguments. Add a new class ("odd") to the odd rows that needs to be styled using CSS. Use addClass function.
From book Dom Scripting by Jeremy Keith.
0
537
posted 13 years ago by alberomo
A JS function that returns the next element of a node. Argument: The node you want to know next element.
From book Dom Scripting by Jeremy Keith.
0
592
posted 13 years ago by alberomo
JS function that takes the accesskey attribute of the links of the document and display them at the end of the document. Takes no arguments.
From book Dom Scripting by Jeremy Keith.
0
487
posted 13 years ago by alberomo
JS function that add a link included in the cite attribute of the blackquote HTML element as sup element close to the blackquote. Takes no argument.
From book Dom Scripting by Jeremy Keith.
0
480
posted 13 years ago by alberomo
This is just a simple explanation of how to use the HTML5 local storage in javascript. The link has a more thorough explanation and an example for those interested. The examples to save, retrive, and clear are marked below.
0
776
posted 13 years ago by FatFolderDesigner
This is a simple example of the google maps javascript API v3. If you want a map with a marker this is the minimum you need to do to get it done. Theres more talk about how it's all set up, and how to use the other static image map as well at the lin...
1
944
posted 13 years ago by FatFolderDesigner