I am trying to write a searchbar and want to have a dynamic amount of params for the search Therefore I am trying to get jquery to firstly load the searchbar (in another file) and then clone it and append it to the body
I already tried changing serveral selectors but it doesnt work as expected
This is my jquery script
$(document).ready(function(){
$("#add").click(function(){
$("#add_div").load("test.php");
});
$("#addbutton").click(function(){
$("#add_div").clone().appendTo("body")
});
});
test.php contains the searchbar
The first load is running as expected (I get the searchbar once) but all clicks on the 'addbutton' (which is loaded with the searchbar) dont do anything
EDIT: fixed a small mistake