After creating an object with JavaScript I am looking to access it with jQuery to manipulate it. Here is some code to make things clearer:
ObjectFunction = function(content) {
this.content = content
}
ObjectFunction.prototype = {
showobject : { return this.appendTo(document.body)}
}
obj = New ObjectFunction()
What I would like to do is as follows, but the syntax is wrong:
$(obj).css{(background:'red')}
This doesn't work. If I create a function in prototype, which would look something like this, it works:
ObjectFunction.prototype = {
showobject : { return this.appendTo(document.body)},
objectmodify: { return this.css{(background:'red')}}
}
// then call something like
obj.objectmodify()
Is there any way to avoid this ugly code for a direct jQuery function applied on the object?