I am very new to jquery plugin and widgets, was just trying out a simple plugin, in which for the div I am trying to append a new div, but it's not able to attach and there are no errors, I am not able to figure out what is the mistake I have done.. The widget code goes below,`(function ($) {
jQuery.widget("ui.test", {
options: {},
_create: function () {
this.element.append("<div>da</div>")
},
_destroy: function () { },
_setOption: function (key, value) { }
});
}(jQuery));`
In the html I have a div with id="test" and it'been called like this,
$("test").test();
Your selector is wrong, in order to use id selector you need # + id
, ex #test
will select the element with id test
$("#test").test();
Demo: Fiddle