Welcome To Snipplr


Everyone's Recent JavaScript Snippets Tagged class



« Prev 1 Next »
  1. FAV

    How To Define Class Private Members in JavaScript

    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.
    JavaScript 4 views posted 6 years ago by apphp-snippets
  2. FAV

    Bare-Bones Selector Engine

    This is a very basic wrapper for querySelectorAll. Just add prototypes and whatever else you need.
    JavaScript saved by 2 people 5 views posted 7 years ago by o0110o
  3. FAV

    Javascript Class Template

    jsHint happy class template for javascript
    JavaScript saved by 3 people 10 views posted 7 years ago by XtreamIT
  4. FAV

    Class handling functions

    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.
    JavaScript saved by 6 people 11 views posted 7 years ago by pmw57
  5. FAV

    Class Manipulation

    Element.prototype functions to manipulate element classes.
    JavaScript saved by 1 person 8 views posted 7 years ago by ChristianOttinger
  6. FAV

    Javascript Object Oriented Template

    JavaScript saved by 1 person 3 views posted 8 years ago by casperskovgaard
  7. FAV

    Classes objects prototype and static

    JavaScript 3 views posted 8 years ago by devnull69
  8. FAV

    Amazing Website Javascript Initialization Code Block v1

    Link body class names to trigger javascript. It requires jQuery.
    JavaScript 2 views posted 8 years ago by cmndo
  9. FAV

    Javascript revealing module pattern template

    "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...
    JavaScript 5 views posted 8 years ago by coprolit
  10. FAV

    Static and Instantiable Classes in JavaScript

    Simple template for setting up classes in JS
    JavaScript 1 views posted 9 years ago by geekyjohn
  11. FAV

    JavaScript Classes

    An implementation of class inheritance in JavaScript.
    JavaScript 2 views posted 10 years ago by wizard04
  12. FAV

    Browser Selector with JavaScript

    Piece of cake and easy to use
    JavaScript 5 views posted 10 years ago by shapeshifta
  13. FAV

    Simple Hovering Element w/ Triggering Element

    added ability to use effects and some other improvements.
    JavaScript 3 views posted 10 years ago by pdswan
  14. FAV

    jQuery Sequential List

    JavaScript 1 views posted 11 years ago by davebowker
  15. FAV

    testing, adding, and removing classes from an html element

    JavaScript saved by 2 people 2 views posted 11 years ago by jambalaya
  16. FAV

    JavaScript’s setTimeout and how to use it with your methods

    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...
    JavaScript 6 views posted 11 years ago by eden159
  17. FAV

    countDown Class in Javascript

    A simple countDown class in Javascript:
    JavaScript saved by 2 people 6 views posted 11 years ago by gfazioli
  18. FAV

    Select All Checkboxes Based On Class

    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...
    JavaScript 3 views posted 11 years ago by aristoworks
  19. FAV

    JavaScript Object Inheritance

    JavaScript saved by 3 people 7 views posted 11 years ago by wizard04
  20. FAV

    class and className

    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...
    JavaScript saved by 4 people 4 views posted 12 years ago by Todd
  21. FAV

    relWindow - New window based on 'rel' attr

    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.
    JavaScript saved by 4 people 3 views posted 13 years ago by mountainash
  22. FAV

    addClass Function

    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).
    JavaScript saved by 6 people 6 views posted 13 years ago by 1man
  23. FAV

    div class changer

    JavaScript 3 views posted 13 years ago by leoh
« Prev 1 Next »