I tried to create JQUERY to append div to existing div
(function($){
$.fn.alertme=function(){
var opts = $.extend( {}, $.fn.alertme.defaults, options );
$divContent =$('<div></div>').appendTo(opts.container);
$divContent.prop('class','divclass');
};
$.fn.alertme.defaults = {
container: "body",
background: "yellow"
};
})(jQuery);
this is how i called it:
$(document).ready(function(){
$('#testbutton').on('click',function(){
$.alertme(
{container : '#target'}
);
});
});
its return error options in not define
please help me guys what i do wrong here
$("#target").alertme()to calling function and usethisinstead ofopts.containerin function defintion$("#target").is selector and you can select any element you want