bootstrap-iconpicker icon indicating copy to clipboard operation
bootstrap-iconpicker copied to clipboard

Does not work when cloned

Open iLenTheme opened this issue 7 years ago • 3 comments

Hello, the plugin is promising and possibly the best in its kind. I have a problem like I do for the cloned iconpicker to work correctly, here's the example: https://jsfiddle.net/iLen/r87e5nh5/1/

help.

iLenTheme avatar May 14 '17 17:05 iLenTheme

Just have to set false as clone function argument.

The doc

The working fiddle

The code with toggle true to false in clone function

jQuery(".aaaa").iconpicker();
jQuery(".a_clone").on("click",function(){
	$(".aaaa").clone(false).insertAfter(".iconpicker_cloned");
        jQuery(".aaaa").iconpicker(); 
});

pbenard73 avatar May 17 '17 20:05 pbenard73

With the clone: ​false this works fine, but if I do this I lose the events of the other input example: onclick, please check this example: example Please check param the .clone link

iLenTheme avatar May 19 '17 00:05 iLenTheme

Yes it could be better, but the main bundle seems to not be maintained....

Here is a hack just for your case : fiddle

$(".base_iconpicker").iconpicker();
$(".btn_clone").on("click",function(){
	var div_cloned = $(".div_to_clone").clone(true).removeClass('div_to_clone').insertAfter(".iconpicker_cloned");
       var errorClonePicker = div_cloned.find('.base_iconpicker');
      errorClonePicker.clone(false).insertAfter(errorClonePicker).iconpicker();
      errorClonePicker.remove(); 
});
$(".div_to_clone input[type='text']").on("click",function(){
	alert("event on click in text input");
});

pbenard73 avatar May 19 '17 19:05 pbenard73