i wrote a function that takes a string as input.
function ajaxLoad(targetBox, loadUrl) {
$("div." + targetBox).css("opacity",0.25);
}
so normally i call this function like this.
ajaxLoad("commentListBox", "some url");
However right now, i have the problem that I need to pass a object i retrieve via a parent selector. so this is not a string but an object.
var box = $(this).parent().parent().toString();
ajaxLoad(box, "some url"); // is a syntax error
How can I handle this?
if i console.log(box);it says [OBJECT]
If you’re using
class, try:If
Id, try: