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 760 posted 10 years ago by apphp-snippets
This is a very basic wrapper for querySelectorAll. Just add prototypes and whatever else you need.
1 639 posted 11 years ago by o0110o
jsHint happy class template for javascript
1 767 posted 11 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 1051 posted 11 years ago by pmw57
Element.prototype functions to manipulate element classes.
1 595 posted 12 years ago by ChristianOttinger
Link body class names to trigger javascript. It requires jQuery.
0 630 posted 13 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 706 posted 13 years ago by coprolit
Simple template for setting up classes in JS
0 683 posted 13 years ago by geekyjohn
An implementation of class inheritance in JavaScript.
0 544 posted 14 years ago by wizard04
Piece of cake and easy to use
0 680 posted 14 years ago by shapeshifta
added ability to use effects and some other improvements.
0 496 posted 14 years ago by pdswan
0 579 posted 15 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 979 posted 15 years ago by eden159
A simple countDown class in Javascript:
1 691 posted 15 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 861 posted 15 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 806 posted 17 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 727 posted 17 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 922 posted 17 years ago by 1man
0 850 posted 17 years ago by leoh
« Prev 1 Next »