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 121 posted 6 years ago by apphp-snippets
This is a very basic wrapper for querySelectorAll. Just add prototypes and whatever else you need.
1 83 posted 7 years ago by o0110o
jsHint happy class template for javascript
1 115 posted 7 years ago by XtreamIT
Standard hasClass, addClass, and removeClass functions, reworked so that jsLint is happier about them, and fixed the removeClass function so that things are trimmed after removing a class name.
2 156 posted 7 years ago by pmw57
Element.prototype functions to manipulate element classes.
1 86 posted 8 years ago by ChristianOttinger
Link body class names to trigger javascript. It requires jQuery.
0 107 posted 9 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 96 posted 9 years ago by coprolit
Simple template for setting up classes in JS
0 77 posted 10 years ago by geekyjohn
An implementation of class inheritance in JavaScript.
0 65 posted 10 years ago by wizard04
Piece of cake and easy to use
0 106 posted 10 years ago by shapeshifta
added ability to use effects and some other improvements.
0 65 posted 11 years ago by pdswan
0 68 posted 11 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 127 posted 11 years ago by eden159
A simple countDown class in Javascript:
1 104 posted 11 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 165 posted 11 years ago by aristoworks
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 104 posted 13 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 104 posted 13 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 129 posted 13 years ago by 1man
0 107 posted 14 years ago by leoh
« Prev 1 Next »