• We just launched and are currently in beta. Join us as we build and grow the community.

Add Textbox Dynamically using jQuery

Λȼє

Trace Evidence Specialist
Λ Rep
0
0
0
Rep
0
Λ Vouches
0
0
0
Vouches
0
Posts
166
Likes
19
Bits
2 MONTHS
2 2 MONTHS OF SERVICE
LEVEL 1 300 XP
Hi sourcecodester,

In this source code, you will learn on how to add TextBox dynamically using jQuery. You can also remove it.

Hope this help.

Sample code:

  1. <?php
  2. include('header.php');
  3. ?>
  4. <body>
  5. <

    script type=

    "text/javascript"

    >
  6. jQuery(

    document)

    .ready

    (

    function

    (

    )

    {

  7. $(

    "#append"

    )

    .click

    (

    function

    (

    )

    {
  8. $(

    ".inc"

    )

    .append

    (

    '<div class="controls"><input type="text"><a href="#" class="remove_this btn btn-danger">remove</a><br><br></div>'

    )

    ;
  9. return

    false

    ;
  10. }

    )

    ;

  11. jQuery(

    '.remove_this'

    )

    .live

    (

    'click'

    ,

    function

    (

    )

    {
  12. jQuery(

    this

    )

    .parent

    (

    )

    .remove

    (

    )

    ;
  13. return

    false

    ;
  14. }

    )

    ;


  15. }

    )

    ;
  16. </

    script>
  17. <br>
  18. <br>
  19. <form class="form-horizontal">
  20. <div class="control-group">
  21. <label class="control-label" for="inputEmail">TextBox</label>
  22. <div class="inc">
  23. <div class="controls">
  24. <input type="text">
  25. <button class="btn btn-info" type="submit" id="append" name="append">Add Textbox</button>
  26. <br>
  27. <br>
  28. </div>
  29. </div>
  30. </div>
  31. </form>
  32. </body>
  33. </html>

Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. After downloading it, you will need a program like Winzip to decompress it.

Virus note: All files are scanned once-a-day by SourceCodester.com for viruses, but new viruses come out every day, so no prevention program can catch 100% of them.

FOR YOUR OWN SAFETY, PLEASE:

1. Re-scan downloaded files using your personal virus checker before using it.

2. NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.


Download
You must upgrade your account or reply in the thread to view hidden text.
 

452,292

324,125

324,133

Top