Nedil Objects - Nedil.Objs (or) $.Objs
Nedil Objects are accessed by "Nedil.Objs" or "$.Objs". These objects are created and returned by $.get(). Nedil Objects wrap HTML elements and provide access to all Nedil APIs .
Example 1
To attach a "click" event to all div elements in a page. (Event Handling is explained separately)
1. Fetch element using $.get(). 2. Attach "click" event to the returned $.Objs
JS
Example 2
// select all div elements in the page var nObj = $.get("div"); // attach "click" event to all div elements using Nedil.Objs nObj.on("click", function() { // listener code goes here });
Above steps can be minimized by combining event attachment with $.get()
JS
// select all div elements in the page and attach "click" event $.get("div").on("click", function() { // listener code goes here }); HTML Elements from Nedil.Objs - Nedil.Objs.elems (or) $.Objs.elems
Raw HTMLElements can retrived from Nedil.Objs using elems property. It is an array of all matched HTMLElements.
Example 1
JS
// select all div elements in the page var nObj = $.get("div"); // Prints the array of matched HTMLElements console.log(nObj.elems); Top Element from Nedil.Objs - Nedil.Objs.element()
Raw top HTMLElement can retrived from Nedil.Objs using element() function. It is equivalent to Nedil.Objs.elems[0].
Example 1
JS
// select all div elements in the page var nObj = $.get("div"); // Prints the top / first HTMLElement console.log(nObj.element()); | |