So for some reason I can't make jquery react on anchor click with class remove. The other function works just fine. I've tried changing it from class to id and it didn't work I've also tried changing id to the id of working function but it still didn't do anything.
<?php
if(isset($_POST['submit'])){
foreach($_POST['champion'] as $champion){
echo $champion.'<br>';
}
}else{
?>
<a href="#" id="AddChampion">Add Champion</a>
<form name="second_form" id="second_form" method="POST">
<div id="ChampionInput">
</div>
<input type="submit" name="submit">
</form>
<?php
}
?>
$(document).ready(function(){
championNumber = 1;
$('a#AddChampion').on('click',function(){
$('#ChampionInput').append(
'<a href="#" class="remove">Remove</a>\
<br>\
<input type="text" name="champion[]" placeholder="Champion '+championNumber+'">\
<br>');
championNumber++;
});
$('a.remove').on('click',function(){
alert('test');
});
});