Thanks!!
Yes, indentation helps make this readable ;-)
AnuragMishra wrote:
>
>
> Thanks for the sample plugin code Sean,
>
> This looks like a really neat plugin, I'll have to take care of the
> indentation though. Can get very messy at 3 levels if not written
> well.
>
> Anurag
>
--
Thanks for the sample plugin code Sean,
This looks like a really neat plugin, I'll have to take care of the
indentation though. Can get very messy at 3 levels if not written
well.
Anurag
On Aug 17, 4:19 pm, duma <[EMAIL PROTECTED]> wrote:
> Anurag,
>
> I've written a Dom element-creating plugin
I wrote a fun dom creation plugin, but in the end it's not much better than
the built in dom creation:
http://jqueryjs.googlecode.com/svn/branches/sean-dev/jquery.dom.js
~Sean
Anurag,
I've written a Dom element-creating plugin for jQuery. The documentation is
here:
http://www.pinkblack.org/itblog/?page_id=22
This is how its usage looks:
var someNodes =
$.create(
"div", {}, [
"span", {"class": "MyText"}, ["Hi! How are you?"],
"img", {"sr
Thanks Sam and Byron for the dynamic DOM creation plugin references.
Like a puzzle, this is all coming together now. Thanks!
--
HLS
On Aug 17, 11:27 am, Sam Collett <[EMAIL PROTECTED]> wrote:
> There are also a few others:http://jquery.com/plugins/project/FlyDOM
>
> Easy DOM creation (which te
There are also a few others:
http://jquery.com/plugins/project/FlyDOM
Easy DOM creation (which technically does not require jQuery, just the
presence of $ in the global namespace):
http://mg.to/2006/02/27/easy-dom-creation-for-jquery-and-prototype
jquery-dom.js
http://www.pinkblack.org/itblog/?p
I guess this is probably just a bit late (and will be even later due
google not posting my replies until after 24-48 hours )
but if your interested i wrote a plugin for creating dom elements from
json templates have a look at it here :
http://jquery.com/plugins/project/appendDom
--Byron
Yes, the 'window' object is the "global" object that everything is a
part of. The DOM for the page is under window.document (on FireFox
anyways, starting to get into details that I don't know a lot about).
If you were to do "window.$someVar" (no quotes) in your FireBug
console, you'll find your n
Nice Erik! Definitely how I like to code! Perfect generalize
"unobstrusive" coding!
I do have a question from the your previous response.
If its not stored in DOM, then were is the variable stored? I'm not
referring to local scoping, but in general, like so:
var $someVar = null;
$(d
If you find yourself doing this kind of thing a lot, it might be handy
to turn it into a plugin (totally off the top of my head and
untested):
(function($) {
var _appendTo = $.fn.appendTo;
$.fn.appendTo = function(parent, n) {
if(n) {
var id = this.attr('id');
> I have to remember that a variable is a "node" in the DOM tree. Does
> that mean that when it initially created, it is hidden?
Not quite. When you create a DOM node from scratch, it exists in
memory, but not as a part of "the DOM" (that is, the collection of DOM
nodes that make up the page), an
Michael replied:
> A single node can't appear twice in the DOM. But you can easily clone a
> node.
>
> http://docs.jquery.com/DOM/Manipulation#clone.28_deep_.29
Ok, thanks. One thing I partially disagree with that Simon fella and
his excellent jQuery writeup, was the idea that if you can separa
On Aug 17, 4:30 am, "Erik Beeson" <[EMAIL PROTECTED]> wrote:
> Actually, technically, what I suggested wastes the original node since
> it never gets inserted, just cloned. Maybe this would be slightly
> better:
>
> function MakeEmailField(n) {
> var $inputBox = $('').attr("type", "text");
>
On Aug 17, 4:25 am, "Erik Beeson" <[EMAIL PROTECTED]> wrote:
> You don't really want multiple fields with the same ID though, do you?
> I think .clone() will help you:
No, but I strategically and intentionally left that in to get this
exact feedback. :-)
Specifically, the id question, which dep
Actually, technically, what I suggested wastes the original node since
it never gets inserted, just cloned. Maybe this would be slightly
better:
function MakeEmailField(n) {
var $inputBox = $('').attr("type", "text");
for(var i = 1; i < n; i++) {
$inputBox.clone().attr("id","email
You don't really want multiple fields with the same ID though, do you?
I think .clone() will help you:
function MakeEmailField(n) {
var inputBox = $('').attr("type", "text");
for (i =0; i < n; i++) {
inputBox.clone().attr("id","email"+i).appendTo('#myForm');
}
}
The initi
> Meaning, is this following valid?
>
> var inputBox = $('').attr("type", "text").attr("id",
> "someText");
> .
> .
> inputBox.appendTo('#myForm');
> inputBox.appendTo('#myForm');
> inputBox.appendTo('#myForm');
>
> In my testing, that doen't work. It only adds the first one.
A si
On Aug 17, 2:49 am, "Karl Rudd" <[EMAIL PROTECTED]> wrote:
> In the examples I gave the new element is "saved" to the variable
> inputBox. So to add it to the DOM you will do something like what Erik
> wrote, that is:
>
> inputBox.appendTo('#myForm');
>
> The above appends it (that is, adds it
In the examples I gave the new element is "saved" to the variable
inputBox. So to add it to the DOM you will do something like what Erik
wrote, that is:
inputBox.appendTo('#myForm');
The above appends it (that is, adds it as the last element) to an
element with id="myForm".
There are other
On Aug 17, 2:10 am, "Karl Rudd" <[EMAIL PROTECTED]> wrote:
> It's already built in. For your example:
>
> var inputBox = $('').attr("type", "text").attr("id", "someText");
>
Karl,
Question, I've still learning jQuery, so please forgive me as I am
not 100% sure if I will poise the question cor
Feel like I hit a jackpot.
Thanks!
On Aug 17, 1:11 am, "Erik Beeson" <[EMAIL PROTECTED]> wrote:
> The jQuery function $() can parse HTML, as can the various DOM
> functions (append, prepend, appendTo, etc):
>
> $('').appendTo('#myForm');
>
> --Erik
>
> On 8/16/07, Anurag <[EMAIL PROTECTED]> wrot
The jQuery function $() can parse HTML, as can the various DOM
functions (append, prepend, appendTo, etc):
$('').appendTo('#myForm');
--Erik
On 8/16/07, Anurag <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> I am a jQuery beginner. I am working on an application for which I
> need to create DOM element
It's already built in. For your example:
var inputBox = $('').attr("type", "text").attr("id", "someText");
Or even:
var inputBox = $('');
Karl Rudd
On 8/17/07, Anurag <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> I am a jQuery beginner. I am working on an application for which I
> need to create
23 matches
Mail list logo