hello everybody
In a dialog I have a button , which in the onclick event, I 'm trying to create a searchbox and linkbutton:
<div id="dlg" class="easyui-dialog">
<a href="#" id="new" class="easyui-linkbutton" data-options="iconCls:'icon-add'">Add</a>
<div id="wrapper"></div>
</div>
so in the jquery code:
$(document).ready(function() {
var max_fields = 3;
var wrapper = $("#wrapper");
var add_button = $("#new");
var x = 0;
$(add_button).click(function(e){
e.preventDefault();
if(x < max_fields){
x++;
$(wrapper).append('<div><input class="easyui-searchbox" data-options="prompt:'Search',searcher:doSearch" name="mytext[]" /><a href="#" class="easyui-linkbutton remove_field" data-options="iconCls:'icon-cancel'"></a></div>');
}
});
$(wrapper).on("click",".remove_field", function(e){ //user click on remove text
e.preventDefault(); $(this).parent('div').remove(); x--;
})
});
but when I click nothing happens
why?