mrspoonzy at gmail Cube by Noah Ellman A powerful javascript toolkit, in research © by Noah Ellman

Getting Started

To help you get started, here is an overview of the fundamentals. To work with any javascript framework, including jwee, it is required that you at the very least have a beginners knowledge of the javascript language.

For introductions to the Javascript langauge, try searching google for now.

If you have used another framework in the past, or if you are experienced with the javascript language, you will most likely find jwee very easy to understand and use.

  • If you are familiar with jQuery
  • Then know that jQuery() is just like jwee() in its use for selecting elements by ID. $() is an easier to type alias for jwee().
  • However, unlike jQuery, in jwee element methods are part of the elements themselves, and not part of jwee object.
  • If you are familiar with Prototype
  • Jwee also installs magic methods to DOM elements.
  • Jwee also extends the native objects, like String and Array with additional methods.
  • In Jwee you can use $() for getting an element by ID.

Key things to know

  • The Jwee object is window.jwee, or simply jwee.
  • jwee itself also contains some uncatagorized functions
  • jwee.dom contains functions for accessing DOM elements and properties
  • contains user agent information
  • jwee.cookie contains cookie related functions
  • jwee is a function itself (see below)
  • For convience sake, many of the commonly used functions have global aliases.
  • $ is an alias for jwee
  • $() is the same as jwee() and
  • Dom is the same as jwee.dom
  • Elem is the same as jwee.elem
  • UA is the same as
  • There are others, but this is a start

Accessing elements

Lets say we have a <DIV> with the id of "foo".

<div id="foo">
Hello World.

To access this <DIV> in code, we use the $, which is just like getElementById.

var myDiv = $('foo');

Note - It is important to note that $ returns the actual DOM element (not a psuedo-element framework object).

The $ function ensures that the element is also enhanced with additional magic methods. For a complete reference to these methods, see here. For example:

$("foo").update("Goodbye World");
// The text in the DIV will change to the text above

Accessing elements with CSS selectors

You can get an array of elements matching a given CSS query using Only use $() for getting by ID. The framework, jQuery, combines all forms of querying into the $() function, but jwee does not. Why?"input");   // All input form items"#foo a");   // All links within the element with id="foo"

var elements ="div.hidden")   // All div elements that are the CSS class "hidden"
elements.each( function() {
} );

// The above line removes the class "hidden" from all DIV's which have it.

Discussion on /getting-started

TheDoctor 11/05/14 :  

Title on this page is messed up:

Zach 11/05/14 :  

@Xymon: Absolutely. My email is zlanich at gmail dot com if you don't wanna post something that extensive in the discussion. Thanks man.

Zach 11/05/14 :  

@Jwee Ninja: Thnx Ninja! I'm def excited about this library. I'm looking forward to seeing how it develops over time. It took me hours to find it :)

Zach 11/05/14 :  

@TheDoctor: You referring to me? lol