Welcome To Snipplr


Everyone's Recent JavaScript Snippets Tagged class



« Prev 1 Next »
Class member encapsulation in JavaScript is very important thing and may be implemented with easy. To define private property or method just use var before the definition or this., if you need to give a public access to property or method.
0 2507 posted 11 years ago by apphp-snippets
This is a very basic wrapper for querySelectorAll. Just add prototypes and whatever else you need.
1 2319 posted 12 years ago by o0110o
jsHint happy class template for javascript
1 2450 posted 13 years ago by XtreamIT
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 3147 posted 13 years ago by pmw57
Element.prototype functions to manipulate element classes.
1 2157 posted 13 years ago by ChristianOttinger
Link body class names to trigger javascript. It requires jQuery.
0 1522 posted 14 years ago by cmndo
"Javascript module pattern emulates the concept of classes in such a way that we're able to include both public/private methods and variables inside a single object, thus shielding/namespacing particular parts from the global scope." When inheritanc...
0 1753 posted 14 years ago by coprolit
Simple template for setting up classes in JS
0 1371 posted 15 years ago by geekyjohn
An implementation of class inheritance in JavaScript.
0 1141 posted 15 years ago by wizard04
Piece of cake and easy to use
0 1413 posted 15 years ago by shapeshifta
added ability to use effects and some other improvements.
0 1107 posted 16 years ago by pdswan
0 1211 posted 16 years ago by davebowker
Everything works as expected for the setTimeout() function until you try to call a method inside your ‘class’ (there are no real classes in JavaScript). Something like this won’t work: setTimeout(this.methodToCall, time); Passing a string r...
0 2043 posted 16 years ago by eden159
A simple countDown class in Javascript:
1 1461 posted 17 years ago by gfazioli
This is a simple javascript snippet that will allow you to specify a particular class to a group of checkboxes and then select them all at once when you click the master checkbox. This came in very handy for a store inventory script when I needed to...
0 1614 posted 17 years ago by aristoworks
1 1510 posted 17 years ago by wizard04
One notorious discrepancy between IE and Firefox (or other "good" browsers) is the way they access the class HTML attribute. While I've used more complicated solutions in the past, this simple solution doesn't require any browser detection or even a...
2 1741 posted 18 years ago by Todd
Based on the linked SitePoint article but with options to limit the container (eg body copy) and set the target. Use '_blank' for a new window for each link. Also adds a class (based on the rel value) for styling. Call the 'relWindow' on window load.
2 1625 posted 18 years ago by mountainash
Function to look if an element has a class, if it doesn't simply add it to the element. If it does have a class add it to the class that is already there. Function expects 2 values, the element to add the class to, and the new class name (value).
3 2044 posted 18 years ago by 1man
0 2615 posted 19 years ago by leoh
« Prev 1 Next »