Weel, it's "simple" (easy to say after a couple of tries, I must
admit). The real reason is in the REGEXP, which does not work at all
for numbers, but only on empty []. So, the FIRST run of the script
works in both cases, since the [] are empty. But then, on the second
run, the REGEXP is failing m
On Aug 24, 3:10 pm, Scott Sauyet <[EMAIL PROTECTED]> wrote:
> var new_name = n.replace(/\[\d?\]/, '[' + OINDEX + ']');
For your code you don't need the \d?, because your template doesn't
have a number in it. That said, your template code is incorrect:
JQ(tpl).find('[EMAIL PROTECTED]').ea
Scott,
Thanks for that replace tip. I've stopped using replace and am now
getting what I want. Weird!
Matt
goodieboy wrote:
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?
No, I don't understand it. This is really odd. I did note that it's in
the regex.repl
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 ht
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'
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 l
John Resig wrote:
I don't know what you're doing, but it works great for me:
http://dev.jquery.com/~john/test/each.html
I'm using value so that it's easy to see the results.
And another version modeled on John's that uses the indices for both the
inner and outer loops is at
http://scot
> From: goodieboy
>
> 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);
> });
> });
>
> How do you access i from within
I don't know what you're doing, but it works great for me:
http://dev.jquery.com/~john/test/each.html
I'm using value so that it's easy to see the results.
--John
On 8/23/07, goodieboy <[EMAIL PROTECTED]> wrote:
>
> Well the syntax in both examples are wrong! :) thanks to my original
> example.
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
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".
Try this:
$('div').each(function( i ){
$(this).find('input').attr('name', 'option_num_' + i);
});
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);
});
});
Try this:
$('form div.options').each()
Your code looks like it'll work, it could even be reduced to:
$('form div.options').each(){function( i ){
$(this).children('[EMAIL PROTECTED]').attr('name', 'option_num_' + i);
});
--John
On 8/23/07, goodieboy <[EMAIL PROTECTED]> wrote:
>
> Hi John,
>
> Actually that was a bad example sorry! W
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);
});
});
How do you access i from within the inner loop? I'm guessin
goodieboy wrote:
What am I doing wrong? Here is an example:
for(i=0; i<10; i++){
$('input').each(function(){
$(this).attr('name', i);
});
}
John's response shows how to get this, if that index is really what you
want. Why this goes wrong, though is a different matter. You have a
n
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 a newly attached set
> of inp
17 matches
Mail list logo