Adding the Select2 function to dynamically added forms

Hi there,

This is my first time posting so please be gentle.

I am running a form which allows you to automatically click add more and more fields for the form appears.

I am using Select2 to make it look good with images in the drop down.

The first drop down is loading just fine but every subsequent addition to the form does not produce the select2.

Before i get into the code here is the desired result.

Here is my code for the form: <form method="POST" action="?page=fws_fixture_admin" id="newFixtures"><div cla - Pastebin.com

The variables $teamdrophome and $teamdropaway are created using a simple php script generating the list from the database.

My Javascript looks like this: <script> $(document).ready(function(){ var i=1; $('#add'). - Pastebin.com

I am assuming the issue is due to the ajax nature of the form adding more lines it isn’t reloading the select2 script.

Now the purpose of this script is for me and one other person only, but if it did ever come to a time of adding more staff I would want it to look as friendly as possible for them.

Thanks for any and all help received.

Nevermind I figured it out.