I am trying to make for jQuery that uses functions on an object.
What I've been trying: (index.html in script tags after adding jQuery and plugin.js)
var object = new myObject("#selected-div");
object.jQueryMadeFunction();
And the plugin.js:
function myObject(param) {
this.param = $(param);
}
$.fn.jQueryMadeFunction = function () {
this.param.css({
background: "red",
height: "100px",
width: "100px"
});
}
I am unsure what I am doing wrong, I have tried multiple things to get this working but now I am completely stuck. What's going wrong and how exactly do I fix it?