K I'm having some issues. I need to get the below to work. I'm very new to jquery/php but I have a drag and drop thats dragging into sortable-list. However the below is not working.. The before "group" is called "squad". The call is below
echo "<p><input type=\"submit\" class=\"input-button\" id=\"btn-add\" value=\"Add Squad\" /></p>";
Then I have the function written as:
$(function(){
var count = 2;
$('#btn-add').click(function(){
if(count == 5){
$('.groupA').append('<div class="groupB"><div class="column left" style="color: darkorange;"><input type="text" name="S' +count+ '" value="Squad ' +count+ '" style="text-align: center; width:151;"></center><ul class="sortable-list"></ul></div>');
if(count > 11){
$('#btn-add').hide();
}
} else if(count == 9){
$('.groupB').append('<div class="groupC"><div class="column left" style="color: darkorange;"><input type="text" name="S' +count+ '" value="Squad ' +count+ '" style="text-align: center; width:151;"></center><ul class="sortable-list"></ul></div>');
}else {
if(count > 11){
$('#btn-add').hide();
}
if (count > 9)
$('.groupC').append('<div class="column left" style="color: darkorange;"><input type="text" name="S' +count+ '" value="Squad ' +count+ '" style="text-align: center; width:151;"></center><ul class="sortable-list"></ul></div>');
else if (count > 4)
$('.groupB').append('<div class="column left" style="color: darkorange;"><input type="text" name="S' +count+ '" value="Squad ' +count+ '" style="text-align: center; width:151;"></center><ul class="sortable-list"></ul></div>');
else
$('.groupA').append('<div class="column left" style="color: darkorange;"><input type="text" name="S' +count+ '" value="Squad ' +count+ '" style="text-align: center; width:151;"></center><ul class="sortable-list"></ul></div>');
}
count++;
});
});
Now I have edited this as Felix fixed my initial issue but now that I have the div fixed, all of my drag and drop is not working anymore. I have manually put one in via php and the drag and drop works for that one, but the ones created using the add button don't work. What am I missing?
Any help is appreciated.