Sunday, November 4, 2012

How to use append textbox and file browser in Jquery

<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <title>Add More Elements</title>
        <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
        <script>
            $(document).ready (function () {
                $('.btnAdd').click (function () {      
                    $('.buttons').append('<div><input type="text" name="uploaded_text[]"><input type="file"  name="uploaded_files[]" class="btnRemove" value="Remove"><input type="button" class="btnRemove" value="Remove"><br></div>'); // end append
                    $('div .btnRemove').last().click (function () {
                        $(this).parent().last().remove();   
                    }); // end click
                }); // end click               

            }); // end ready
        </script>
    </head>
    <body>
        <div class="buttons">
             <input type="button" class="btnAdd" value="Add"><br>
        </div>
    </body>
</html>

No comments:

Post a Comment

Thank you for your Comment....

Popular Posts