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 403 posted 7 years ago by apphp-snippets
This is a very basic wrapper for querySelectorAll. Just add prototypes and whatever else you need.
1 322 posted 8 years ago by o0110o
jsHint happy class template for javascript
1 401 posted 9 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 523 posted 9 years ago by pmw57
Element.prototype functions to manipulate element classes.
1 303 posted 9 years ago by ChristianOttinger
Link body class names to trigger javascript. It requires jQuery.
0 351 posted 10 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 382 posted 10 years ago by coprolit
Simple template for setting up classes in JS
0 370 posted 11 years ago by geekyjohn
An implementation of class inheritance in JavaScript.
0 282 posted 11 years ago by wizard04
Piece of cake and easy to use
0 364 posted 11 years ago by shapeshifta
added ability to use effects and some other improvements.
0 260 posted 12 years ago by pdswan
0 274 posted 12 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 462 posted 12 years ago by eden159
A simple countDown class in Javascript:
1 331 posted 13 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 438 posted 13 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 352 posted 14 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 355 posted 14 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 462 posted 14 years ago by 1man
0 389 posted 15 years ago by leoh
« Prev 1 Next »