Have you tried .append()? This test page works for me in Firefox 3.0b3/
Mac. I haven't tested it in anything else:

<html>
        <head>
                <script
                        type="text/javascript"
                        src="http://cachefile.net/scripts/jquery/1.2.3/
jquery-1.2.3.min.js">
                </script>
                <script type="text/javascript">
                var inputcount = 0;

                $(function(){
                        $('#makeinput').click(function(){
                                inputcount += 1;
                                $('#container').append(
                                        '<input id="input_'
                                        + inputcount
                                        + '" name="input_'
                                        + inputcount
                                        + '" type="file" />'
                                );
                        });
                });
                </script>
        </head>
        <body>
                <p id="makeinput">Make A File Input</p>
                <form name="test" method="post" enctype="multipart/form-data">
                        <div id="container"></div>
                        <input id="go" name="go" type="submit" value=" Go " />
                </form>
        </body>
</html>


HTH,
Jason





On Mar 9, 1:58 pm, Vivek <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I am new in Jquery. I am trying to add file upload field in an form.
> We can't user $("#container").html() or text() for file upload field
> because they will not pass the values to other pages. So we have to
> create an element on the fly. I am not able to figure it out that how
> can i create an element on the fly ?  I am using add() however it is
> not working for me.
>
> Can anyone help me about this. i need to create three file upload
> field on the fly when an users click on an button having id as
> container.
>
> Thanks

Reply via email to