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]').each(function(){
Carefully count the [ and ] characters in that string and you'll find
that they're mismatched and cannot match your regex:
var new_name = n.replace(/\[\d?\]/, '[' + OINDEX + ']');
Also, it wouldn't surprise me if you need to escape the [ and ] inside
the find() command, as detailed in the FAQ:
http://docs.jquery.com/Frequently_Asked_Questions#How_do_I_select_an_element_that_has_weird_characters_in_its_ID.3F
But apparently your working example demonstrates that that's not
necessary. THAT i can't explain, though.
:)