[jQuery] Re: How to add/remove dynamic blocks of html

2007-09-29 Thread Glen Lipka
I suggest LiveQuery. Really easy to use. I haven't tried the other. Also check out the FlyDOM plugin. Might be useful. http://jquery.com/plugins/project/FlyDOM Glen On 9/29/07, goodieboy <[EMAIL PROTECTED]> wrote: > > > Hi, > > I've created code to dynamically add blocks of form elements to a

[jQuery] Re: How to add/remove dynamic blocks of html

2007-09-29 Thread James Dempster
I've never really understood the point to FlyDOM. It seems like a nice idea, but whats wrong with just using jQuery? FlyDOM $('#exampleCA').createAppend( 'table', { width: '718px', style: 'border: 2px inset #336699;' }, [ 'tr', { className: 'exampleRow' }, [ 'td', { align:

[jQuery] Re: How to add/remove dynamic blocks of html

2007-09-29 Thread Michael Geary
> From: James Dempster > > I've never really understood the point to FlyDOM. It seems > like a nice idea, but whats wrong with just using jQuery? > > FlyDOM > $('#exampleCA').createAppend( > 'table', { width: '718px', style: 'border: 2px inset #336699;' }, [ > 'tr', { className: 'ex

[jQuery] Re: How to add/remove dynamic blocks of html

2007-09-29 Thread James Dempster
Thanks Mike, that is nice to know. Ofcourse all that could go on one line but I dont find it very readable and will be doing what you mentioned from now on. On 9/29/07, Michael Geary <[EMAIL PROTECTED]> wrote: > > > > From: James Dempster > > > > I've never really understood the point to FlyDOM. I

[jQuery] Re: How to add/remove dynamic blocks of html

2007-09-29 Thread Jack Killpatrick
FWIW, I used FlyDOM and some like it and gave up on them, because: 1. syntax debugging made me cranky, compared to just writing HTML 2. it was noticably slower for more than just some small usages 3. I discovered this: http://code.google.com/p/trimpath/wiki/JavaScriptTemplates With those (trim

[jQuery] Re: How to add/remove dynamic blocks of html

2007-09-30 Thread howardk
Nice use of join()! I'm new to JavaScript and jQuery both, and it's nice to come across little snippets like this I can readily add to my jQuery repetoire and that slightly expand my understanding of JavaScript. By the way, the docs show that it's legal to pass, as an argument to append(), either

[jQuery] Re: How to add/remove dynamic blocks of html

2007-09-30 Thread Michael Geary
Glad you like the [].join('') trick, Howard - and good catch on the unnecessary wrapper. You didn't miss anything, and that simplifies the example down to: $('#exampleCA').append( [ '', '', '', 'I was created by jQuery append', '',

[jQuery] Re: How to add/remove dynamic blocks of html

2007-10-01 Thread James Dempster
One of the greatest things about jQuery though is that the code is quite easy to read and understand, so if unsure just check. If still unsure, then what a great active community though the groups ! Love the tips, it might be quite nice if maybe the core could be changed to accept an array (maybe

[jQuery] Re: How to add/remove dynamic blocks of html

2007-10-01 Thread Matt
Hi everyone, I have been using FlyDOM, and am trying to convert some of that code to use the jQuery append, after reading what Mike wrote about better performance. I am trying to dynamically insert some attributes. However I'm getting a syntax error, so I think I'm not understanding something simp

[jQuery] Re: How to add/remove dynamic blocks of html

2007-10-01 Thread James Dempster
I think this it what your trying todo... $(this).parent().append(["", "x", ""].join("")); Much nicer to split the lines making it more readable. $(this).parent().append([ "", "x", "" ].join("")); hope this helps On Oct 1, 5:29 pm, Matt <[EMAIL PROTECTED]> wrote: > Hi everyone,

[jQuery] Re: How to add/remove dynamic blocks of html

2007-10-01 Thread Michael Geary
> From: James Dempster > > Much nicer to split the lines making it more readable. > > $(this).parent().append([ > "", > " "x", > "" > ].join("")); Also, once you're using .join, you don't have to use + inside it; you can use comma for all your string concatenation. And t

[jQuery] Re: How to add/remove dynamic blocks of html

2007-10-02 Thread James Dempster
I'd total agree with what Michael said. Infact HTML coding guidelines and W3C Standards say that HTML quotes should be double " Also as a PHP developer I tend to use single quotes ' for programming, but that's because in PHP it doesn't use the parse engine looking for varibles, but thats a differen

[jQuery] Re: How to add/remove dynamic blocks of html

2007-10-02 Thread howardk
I do occasionally look at the source code, but I'm still new enough to JavaScript that sometimes (even with 12 years of Java under my belt, and a whole slew of other languages going back some 40 years) that when I'm faced with new js constructs for the first time, about all I can do is stare glass

[jQuery] Re: How to add/remove dynamic blocks of html

2007-10-02 Thread Matt
thank you guys, I really appreciate your comments and insight! On Oct 1, 10:05 pm, howardk <[EMAIL PROTECTED]> wrote: > I do occasionally look at the source code, but I'm still new enough to > JavaScript that sometimes (even with 12 years of Java under my belt, > and a whole slew of other languag

[jQuery] Re: How to add/remove dynamic blocks of html

2007-10-02 Thread Michael Geary
> > $('#exampleCA').append( [ > > '', > > '', > > '', > > 'I was created by jQuery append', > > '', > > '', > > '' > > ].join('') ); > I do occasionally look at the source code, but I'm still new > enough to JavaS