Sunday, 15 September 2013

Keep getting [object] [Object] from variable

Keep getting [object] [Object] from variable

I am trying to get the value of the variable $target but when I print it I
keep getting [object] [Object] for the value. I am new to jQuery so this
is probably a very simple problem something I am missing.
$("body").click(function(event) {
var $target = $(event.target.id);
$("#log").html("clicked: " + $target);
});

No comments:

Post a Comment