for(var i = 1; i <= materias_num; i++){
                $("#fd_opcoes").append(loop.replace(/1/g,''+i));
        }

On Dec 13, 7:18 pm, Marcelo Wolfgang <[EMAIL PROTECTED]> wrote:
> Hi all,
>
> I've a form with a numeric drop down ( from 1 to 10 ) and when the
> user select a number from it, I want to add the corresponding number
> of textfields in my code, but I need to change the input name and I
> can't figure out how to do that this is what I have right now
>
> $("#add_opcoes").change(function (){
>         var materias_num = this.value;
>         var loop = $("#fd_opcoes").html()
>         $("#fd_opcoes").empty()
>         for(var i = 1; i <= materias_num; i++){
>                 $("#fd_opcoes").append(loop);
>         }
>
> });
>
> and this is what is inside loop
>
> <div id="add_formOpcao_1" class="overflow">
>         <label for="add_opcao_1">Material 1:</label>
>         <input name="add_opcao_1" type="text" size="50" />
> </div>
>
> what I want is to change all the 1 that are inside the variable with i
> from the looping ( so it will be 1, 2 ...10 )
>
> is there a way to do that easily or should I look at other options ?
>
> TIA
> Marcelo Wolfgang

Reply via email to