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

2007-09-29 Thread goodieboy
Hi, I've created code to dynamically add blocks of form elements to a form. Basically, a set of text fields and radio buttons. It seems to work fine now, but my code is completely dependent on the structure of the html, which is expected I guess and I'd like to do is simplify my code. Because

[jQuery] Re: Very confused!

2007-08-25 Thread goodieboy
Scott, Thanks for that replace tip. I've stopped using replace and am now getting what I want. Weird! Matt

[jQuery] Re: Very confused!

2007-08-24 Thread goodieboy
OK I've got the same problem happening again in a different page. I'd love to know why this is happening before I start re-arranging all of my html. Anyone know what could be causing this? matt On Aug 23, 10:23 pm, goodieboy [EMAIL PROTECTED] wrote: OK, turns out I am crazy, but thanks to html

[jQuery] Re: Very confused!

2007-08-23 Thread goodieboy
[EMAIL PROTECTED] wrote: Like so: $('input').each(function(i){ $(this).attr('name', i); }); Nice and simple! --John On 8/23/07, goodieboy [EMAIL PROTECTED] wrote: OK, I thought I knew jQuery pretty well. But this is completely stumping me. What I want to do is iterate through

[jQuery] Re: Very confused!

2007-08-23 Thread goodieboy
Sauyet [EMAIL PROTECTED] wrote: goodieboy wrote: Hi John, Actually that was a bad example sorry! What about something like this: $('form div.options').each(){function( i ){ $(this).children('[EMAIL PROTECTED]').each(function(){ $(this).attr('name', 'option_num_' + i

[jQuery] Re: Very confused!

2007-08-23 Thread goodieboy
I meant NOT real/realtime loops like a for. -matt On Aug 23, 12:30 pm, goodieboy [EMAIL PROTECTED] wrote: Well the syntax in both examples are wrong! :) thanks to my original example. Fixing the syntax still gives the same results. The value set in the inner each is the last value set to i

[jQuery] Re: Very confused!

2007-08-23 Thread goodieboy
Hi, I know there are no event handlers in the classic sense, I was referring to the function that handles the iteration passed to each. In a way, it is an event handler though. And by event I mean, a single iteration. I am however confused. :) because the last example posted (outer and inner

[jQuery] Re: Very confused!

2007-08-23 Thread goodieboy
OK, turns out I am crazy, but thanks to html and javascript. So, depending on the arrangement of the default .productOption div, I either get the behavior you all have described, or the behavior I have described. Below, if '.productOption' is after the '#newProductOptions' div, the number doesn't

[jQuery] Very confused!

2007-08-22 Thread goodieboy
OK, I thought I knew jQuery pretty well. But this is completely stumping me. What I want to do is iterate through a newly attached set of input elements, and set their names based on a dynamic (incrementing) number. But the only value that ever gets used is the initial value of the variable. I've

[jQuery] Loading a DOM Element with Rails Template Syntax?

2007-08-20 Thread goodieboy
Hi, I've got a template that is loaded into the page, and immediately hidden by jQuery. I want to duplicate it and append it into another place on the page. The situation is that there are spots in the HTML fragment that have the Rails template syntax: % something.each do | item| %. What I'd

[jQuery] Seach and replace Rails template tags

2007-08-20 Thread goodieboy
Hi, I'm trying to search through a node and find all of the Rails template tags: % and %. I'd like to simply remove them, but can't figure out how. How is this done? :) Thanks! -- View this message in context:

[jQuery] Re: Seach and replace Rails template tags

2007-08-20 Thread goodieboy
! Matt On Aug 20, 3:38 pm, Estevão Lucas [EMAIL PROTECTED] wrote: Hi, Rails generate the code HTML that jQuery will access it. You cannot access a Rails code because Rails run on server and JavaScript run on client-side 2007/8/20, goodieboy [EMAIL PROTECTED]: Hi, I'm trying to search through