Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is el / element? How do I use it? And why? [closed]

Tags:

jquery

Pardon me if this is a n00b-ish question but if the shoe fits I'll just have to wear it. What I'm trying to say is, please type slow so I can pick up what you're laying down.

I have read this:

What is ".el" in relationship to JavaScript/HTML/jQuery?

But it didn't help me (and where I am currently on the learning curve).

I've also tried Googling but that doesnt' seem to turn up much. Perhaps I'm not using the right keywords?

like image 740
Chief Alchemist Avatar asked Sep 01 '12 17:09

Chief Alchemist


2 Answers

It is just a plugin added to jquery to help you make the DOM easily.
then

$.el.table(
 $.el.tr(
   $.el.th('first name'),
   $.el.th('last name')),
 $.el.tr(
   $.el.td('Joe'),
   $.el.td('Stelmach'))
).appendTo(document.body);

is equivalent to

$('body').append("<table><tr>
      <th>first name</th><th>last name</th>
    </tr><tr>
      <td>Joe</td><td>Stelmach</td>
    </tr></table>");

Notice that the Laconic Plugin is not a native plugin of jquery.

like image 160
Dariush Jafari Avatar answered Oct 14 '22 08:10

Dariush Jafari


It is the name that the Laconic plugin uses when added to jQuery.

It's used to create elements. For example, $.el.div('text') does the same as $('<div/>').text('text').

like image 33
Guffa Avatar answered Oct 14 '22 09:10

Guffa