Skip to content
Advertisement

Append Dropdown Form using javascript – Laravel

I have a form with a dropdown. I want to make the dropdown to appear multiple times on click of a button. Like picture below:

enter image description here

If I click “add more student” button, another student’s dropdown should appear.

Here is my code

JavaScript

JavaScript

And the script:

JavaScript

This code is not working. When I click the button, nothing happens.Can anyone help me with this?

Advertisement

Answer

First you forgot # before $("#more_student").append(html); and if you have multiple student_profile_id then you have to make it array like name="student_profile_id[]" and every control has unique id

try this one

JavaScript
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement